경고보기 .tag를 사용하여 일부 방법을 읽었지만 작동하지 않습니다.하나의보기 컨트롤러에서 여러 경고보기 (태그가 작동하지 않음)
첫 번째 경고 :
-(void)addNewTask
{
UIAlertView * alert1 = [[UIAlertView alloc] initWithTitle:@"New Task"
message:nil
delegate:self
cancelButtonTitle:@"Cancel" otherButtonTitles:@"OK",nil];
alert1.alertViewStyle = UIAlertViewStylePlainTextInput;
[alert1 show];
}
두 번째 경고
-(void)changeTime:(int)value atRow:(int)p
{
TaskData *data = [tasks objectAtIndex:p];
NSLog([NSString stringWithFormat:@"%d %d",data.time,value]);
int time = data.time ;
time += value;
data.time = time;
NSLog([NSString stringWithFormat:@"%d %d",data.time,value]);
[self saveData:tasks];
[self.Taskview reloadData];
if(time>=5&&(data.leveljudge!=1))
{
UIAlertView *alert2 = [[UIAlertView alloc] initWithTitle:@"Congratulation!!!"
message:@"You have achieve Senior Level. "
delegate:nil
cancelButtonTitle:@"Cancel" otherButtonTitles:@"YES",nil];
data.leveljudge=1;
[alert2 show];
}
대표 :
-(void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex{
NSString *name = [alertView buttonTitleAtIndex:buttonIndex];
if ([name isEqualToString:@"OK"])
{
UITextField *tf=[alertView textFieldAtIndex:0];
NSString *name = tf.text;
TaskData *newTask = [[TaskData alloc] init];
newTask.TaskName = name;
newTask.time = 0;
newTask.leveljudge=0;
[tasks addObject:newTask];
[self saveData:tasks];
[self.Taskview reloadData];
}
else if ([name isEqualToString:@"YES"]) {
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"http://d.blog.xuite.net/d/1/5/4/12103250/blog_1606564/txt/53796893/2.jpg"]];
}
}
문제 대리인은 첫 번째 경고에만 작동합니다. 당신이 대리자를 설정하지 않았기 때문에 alert2를 들어 https://www.youtube.com/watch?v=WxlVKk0CTiQ
두 번째 경고 대리인을 설정하지 않습니다. UIAlertView * alert2 = [[UIAlertView alloc] initWithTitle : @ "축하합니다 !!!" message : @ "당신은 고위급을 달성했습니다." ** 대리인 : nil ** cancelButton 제목 : @ "취소"otherButtonTitles : @ "예", nil]; 천막 대표자 : 자아. 대의원이 동참 할 것입니다. – Savitha
'tag '를 사용하면 효과가 있습니다. 태그 사용 시도는 어디에서합니까? – rmaddy