Dev*_*ted 3 iphone objective-c uialertview
我让AlertView与"cancelButtonTitle:@"取消""和"otherButtonTitles:nil"完美配合.我的问题是如何获得其他按钮.
当我只更改"otherButtonTitles:@"第二个按钮""时,iPhone模拟器刚刚从应用程序崩溃并进入主屏幕.
Kev*_*ner 10
你想结束你的方法调用,如下所示:
... cancelButtonTitle:@"Cancel" otherButtonTitles:@"Button1Title", @"Button2Title", nil];
这与您在String格式中看到的模式相同,其中参数列表可以是任意长度.通常,参数列表以nil结尾.不要忘记零.
究竟像凯文说,但作为附录的是,你还可以指定目标行动的其他按钮.
实例化时UIAlertView,将delegate参数设置为self,然后将以下方法添加到对象:
-(void) alertView: ( UIAlertView *) alertView
clickedButtonAtIndex: ( NSInteger ) buttonIndex {
// do stuff
// if you want the alert to close, just call [ alertView release ]
}
Run Code Online (Sandbox Code Playgroud)
`
| 归档时间: |
|
| 查看次数: |
4841 次 |
| 最近记录: |