区分actionsheet

UIActionSheet *actionSheet = [[UIActionSheet alloc] initWithTitle:@"Change Arrow"
                                                     delegate:self
                                            cancelButtonTitle:@"cancel"
                                       destructiveButtonTitle:@"Red"
                                            otherButtonTitles:@"Blue",@"Black",nil];
actionSheet.tag = 1;
UIActionSheet *actionSheet2 = [[UIActionSheet alloc] initWithTitle:@"Change Arrow"
                                                         delegate:self
                                                cancelButtonTitle:@"cancel"
                                           destructiveButtonTitle:@"Red"
                                                otherButtonTitles:@"Blue",@"Black",nil];
actionSheet2.tag = 2;



then

- (void) actionSheet: (UIActionSheet *)actionSheet didDismissWithButtonIndex:(NSInteger)buttonIndex{
 if(actionSheet.tag == 1) {
     //do something
 } else if(actionSheet.tag == 2) {
     //do something else
 }
}

猜你喜欢

转载自lizhuang.iteye.com/blog/2089486