UIAlert审查页面

0 iphone objective-c uialertview

我对iPhone编码很新,想知道是否有人可以帮助我.

准备好代码,以便当应用程序加载UIAletView时加载并提示用户查看/评价应用程序,但我有一个名为"从不评分"的按钮

我需要帮助来找出如何编写"永不率"按钮的代码,以便在按下时,每次加载应用程序时都不会加载UI警报.

到目前为止这是我的代码:

(void)viewDidLoad {


 UIAlertView *alert;
 alert = [[UIAlertView alloc] initWithTitle:@"Rate My Appication" message:@" Please Rate my Application and check out my other Apps" 
           delegate: self 
        cancelButtonTitle:@" Cancel " 
        otherButtonTitles: @" Rate Now ", @"Check Other Apps", @" Never Rate ", nil];

 [alert show];
 [alert release];
}

(bool)alertView:(UIAlertView *)actionSheet clickedButtonAtIndex:(NSInteger)buttonIndex {

 // Never Review Button
 if (buttonIndex == 3)
 {


 }

 // Review Button 
 else if (buttonIndex == 1)
 {
  [[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"http://itunes.apple.com/gb/app/calculator/id389197581?mt=8"]];
 }

 // Other Apps Button 
 else if (buttonIndex == 2)
 {
  [[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"http://itunes.com/apps/2headsolutions"]];
 }

}
Run Code Online (Sandbox Code Playgroud)

Ren*_*ers 6

您可以在磁盘上的某处存储布尔标志.然后,下次检查neverRate == NO并相应地显示警报.

您可以使用NSUserDefaults存储它:

[[NSUserDefaults standardDefaults] setBool:YES forKey:@"neverRate"];
Run Code Online (Sandbox Code Playgroud)

然后检索它:

BOOL neverRate = [[NSUserDefaults standardDefaults] boolForKey:@"neverRate"];
if(neverRate != YES) {
  //Show alert here
}
Run Code Online (Sandbox Code Playgroud)