UIAlertView(경고창) 띄우는 방법과 경고창이 여러개일 때, 이벤트 구별하는 방법
//경고창 1.
UIAlertView *alert = [[UIAlertView alloc]initWithTitle:@"A" message:@"" delegate:self cancelButtonTitle:@"확인" otherButtonTitles:@"취소", nil];
[alert show];
[alert release];
//경고창 2
UIAlertView *alert =[[UIAlertView alloc]initWithTitle:@"B" message:@"" delegate:self
cancelButtonTitle:@"확인" otherButtonTitles:@"취소", nil];
[alert show];
[alert release];
//경고창 3
UIAlertView *alert = [[UIAlertView alloc]initWithTitle:@"C" message:@"" delegate:self
cancelButtonTitle:@"확인" otherButtonTitles:@"취소", nil];
[alert show];
[alert release];
//경고창의 버튼 이벤트를 감지하는 델리게이트.
- (void)alertView:(UIAlertView *)alertView didDismissWithButtonIndex:(NSInteger)buttonIndex
{
//경고창의 타이틀을 비교해서 경고창을 구별한다.
if ( [[alertView title] isEqualToString:@"A"])
{
if(buttonIndex==0){
}else {
}
}
else if ( [[alertView title] isEqualToString:@"B"])
{
if(buttonIndex==0){
}
}
else if ( [[alertView title] isEqualToString:@"C"])
{
if(buttonIndex==0){
}
}
}