我在编程UIAlertView的时候有点新鲜。我想到的是做一个弹出窗口,显示应用程序启动时除了默认解雇按钮之外还有两个按钮。 其中一个按钮将是一个到appstore的链接,另一个则是永久关闭该弹出窗口。 除了最后一个按钮之外,我已经完成了所有操作。 有什么帮助吗?点击按钮后弹出警告消失
谢谢!
- (void)viewDidLoad {
alert = [[UIAlertView alloc] initWithTitle:@"Rate!" message:@"Your rate is much apreciated" delegate:self cancelButtonTitle:@"Not Now" otherButtonTitles:@"Okay! ", @"No, Thanks!", nil ];
[alert show];
[alert release];
}
-(void)alertView:(UIAlertView *) alertView clickedButtonAtIndex:(NSInteger)buttonIndex{
if (buttonIndex == 0) {
}
if (buttonIndex == 1) {
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"http://itunes.apple.com/pt/app/designertools/id444778173?mt=8#" ]];
}
}
取消按钮不应该需要任何特殊设置或任何东西。现在点击它时会发生什么? –