我正在创建一个 iOS 应用程序,当分数达到 100 时,将显示此警报,并且一切正常,但按钮(分享、苹果、评价此应用程序)。
- (void) buttonAction {
counter++;
if(counter == 100)
[self showAlert];
}
- (void) showAlert {
UIAlertView *alert = [[UIAlertView alloc]
initWithTitle:@"hello"
message:@"whats you name"
delegate:nil
cancelButtonTitle:@"Dismiss"
otherButtonTitles:@"share", @"apple" , @"rate this app", nil];
-(void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex{
if (buttonIndex == 0) { // means share button pressed
// write your code here to do whatever you want to do once the share button is pressed
}
if(buttonIndex == 1) { // means apple button pressed
// write your code here to do whatever you want to do once the apple button is pressed
}
// and so on for the last button
}
[alert show];
}
-(IBAction)plus {
counter=counter + 1;
count.text = [NSString stringWithFormat:@"%i",counter];
if(counter == 100)
[self showAlert];
}
-(IBAction)zero {
counter=0;
count.text = [NSString stringWithFormat:@"%i",counter];
}
- (void)viewDidLoad {
counter=0;
count.text = @"0";
[super viewDidLoad];
}
我想要什么我在哪里添加链接等谢谢