我想我错过了一些明显的东西。我必须UIAlertView
获得应用程序审查,但我无法获得执行任何操作的按钮。我已经打电话给UIAlertViewDelegate
in my.h
,我也有花药UIAlertview
,它只是在 an 上IBAction btn
,虽然它只是有 cancel ,但效果很好btn
。
我尝试给予,alert.tag = 1
但没有任何区别,所以我评论了我的第一个UIAlertview
,所以我只有一个警报,仍然没有快乐。我想我错过了一些简单的东西。
我也试过alertview.cancelButtonIndex
oralertview.firstOtherButtonIndex
而不是 0
-(void) alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex {
if (buttonIndex == 0) {
NSLog(@"index 0 ");
}
else if (buttonIndex == 1) {
NSLog(@"index 1 ");
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"www.google.com"]];
NSUserDefaults *rateApp = [NSUserDefaults standardUserDefaults];
NSInteger appLaunch = [ rateApp integerForKey:@"appLaunch"];
appLaunch = 0 ;
[rateApp setInteger: appLaunch forKey:@"appLaunch"];
}
else if (buttonIndex == 2) {
NSLog(@"index 2 ");
}
}
- (void)viewDidLoad
{
[super viewDidLoad];
//rate app appLaunch == 5 || appLaunch ==10
NSUserDefaults *rateApp = [NSUserDefaults standardUserDefaults];
NSInteger appLaunch = [ rateApp integerForKey:@"appLaunch"];
if (appLaunch == 1 ) {
UIAlertView *alert = [[UIAlertView alloc]initWithTitle:@"Like this app ?" message:@"Why not rate at the app store" delegate:nil cancelButtonTitle:@"No thanks" otherButtonTitles:@"Yes",@"Remind me later", nil];
// alert.tag = 1;
[alert show];
}
谢谢你的帮助。