iphone - How to use multiple UIAlertView inside one IBAction with different button? -
is possible show different alerts different buttons in same ibaction based on different conditions?? have code in ibaction:
- (ibaction)btnrecommendationtapped:(id)sender { uialertview *alert = [[uialertview alloc] initwithtitle: @"recommendation" message: @"it seems interested in %d of collection." delegate: nil cancelbuttontitle: nil otherbuttontitles: @"yes", @"no", nil]; [alert show]; }
i have alert shows "sorry! unable provide recommendation" ok button. when condition has fulfilled shows 1 in ibaction otherwise shows one.
-(ibaction)buttonclicked:(id)sender { if([sender tag]==0) { uialertview *alert = [[uialertview alloc]initwithtitle:@"button 1 clicked" delegate:self cancelbuttontitle:@"ok" otherbuttontitles:nil, nil]; [alert show]; } else if ([sender tag]==1) { uialertview *alert = [[uialertview alloc]initwithtitle:@"button 2 clicked" delegate:self cancelbuttontitle:@"ok" otherbuttontitles:nil, nil]; [alert show]; } else if ([sender tag]==2) { uialertview *alert = [[uialertview alloc]initwithtitle:@"button 3 clicked" delegate:self cancelbuttontitle:@"ok" otherbuttontitles:nil, nil]; [alert show]; } }
Comments
Post a Comment