目标c中有这样的东西吗? 链接plz和一些指南
谢谢你们每个人
答案 0 :(得分:2)
您正在寻找UIAlertView控制器。
答案 1 :(得分:0)
我相信你想要UIActionSheet
,Apple推荐用户选择:
UIActionSheet *actionSheet = [[UIActionSheet alloc] initWithTitle:@"Some Message" delegate:self cancelButtonTitle:@"Cancel" destructiveButtonTitle:@"button To Destroy or nil" otherButtonTitles:@"Choice 1", @"Choice 2", @"Choice 3", nil];
答案 2 :(得分:0)
您要做的是检查otherButtonTitles:
这样的事情:
UIAlertView *yourAlert = [[UIAlertView alloc] initWithTitle:@"Your title" message:@"Some String" delegate:self cancelButtonTitle:@"Dismiss" otherButtonTitles:@"Confirm",nil];
[yourAlert show];
请记住将代表设置为自己。
然后:
- (void)alertView:(UIAlertView *)alertView didDismissWithButtonIndex:(NSInteger)buttonIndex { if (buttonIndex == 0){ //'Dismissing' code here } if (buttonIndex == 1){ //Detecting whatever was under otherButtonTitles: //Right now it's checking if the user clicked "Confirm" -> So here you can put whatever you need NSLog(@"You clicked Confirm"); }
}
在条件下,您正在检查用户点击的按钮。