출처 : http://cafe.naver.com/mcbugi/246495
@implementation JKAlertView
/**
Modal 형태로 대화상자를 띄우는 메서드
@return 버튼 Index
*/
- (NSInteger)show
{
_buttonIndex = -1;
[self setDelegate:self];
[super show];
// Event Loop
CFRunLoopRun();
// 버튼 Index 반환
return _buttonIndex;
}
#pragma mark -
#pragma mark UIAlertViewDelegate
- (void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex
{
_buttonIndex = buttonIndex;
// Event Loop 종료
CFRunLoopStop(CFRunLoopGetCurrent());
}
@end
JKAlertView * alert = [[JKAlertView alloc] initWithTitle:@"JKAlertView" message:@"사용법" delegate:nil cancelButtonTitle:@"취소" otherButtonTitles:@"확인", nil];
if (1 == [alert show])
{
// 인덱스 1번 버튼 눌렸을 때
}
[alert release];
'프로그래밍 > iOS' 카테고리의 다른 글
objective c SHA256 암호화 (0) | 2013.02.08 |
---|---|
OTA ( Over the Air AdHoc ) 2 (0) | 2013.01.30 |
샘플코드와 그림으로 잘 정리한 UINavigationController Customization Tutorial (0) | 2012.11.07 |
두 좌표간 거리 구하는 메소드 (0) | 2012.10.20 |
내 어플에 GameCenter (게임센터) 를 붙여보자 + 겜센터 스타일 노티도 띄워보자! (0) | 2012.09.14 |