UIAlert 查看 Objective C - 打开应用商店链接
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:nil message:@"An Alert!"
delegate:self cancelButtonTitle:@"OK" otherButtonTitles:[[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"http://phobos.apple.com/WebObjects/MZStore.woa/wa/viewSoftware?id=301349397&mt=8"]];];
[alert show];
[alert release];
我正在尝试显示一个带有一个“确定”按钮和一个“购买完整版本”按钮的 UIAlertView。我怎样才能使上面的代码工作?
谢谢
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:nil message:@"An Alert!"
delegate:self cancelButtonTitle:@"OK" otherButtonTitles:[[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"http://phobos.apple.com/WebObjects/MZStore.woa/wa/viewSoftware?id=301349397&mt=8"]];];
[alert show];
[alert release];
I'm trying to display a UIAlertView with one "Ok" button and one "Buy Full Version" button. How can i make the above code work?
Thanks
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您需要处理
UIAlertViewDelegate
。
另外,
otherButtonTitles
只是用作标题的NSString
对象的va_list
,您可以设置在UIAlertViewDelegate< 中点击它们时会发生什么。 /code> 的
alertView:clickedButtonAtIndex:
方法:不要忘记设置
delegate
:You need to handle the button click in the
UIAlertViewDelegate
that you specify.Also,
otherButtonTitles
is simply ava_list
ofNSString
objects to use as titles, you set what happens when they are tapped inUIAlertViewDelegate
'salertView:clickedButtonAtIndex:
method:Don't forget to set the
delegate
: