我已經做這的UIAlertView
第二個按鈕是應該將比分重置爲0。UIAlertView中ClickedButtonAtIndex不會救整數
這裏是我的UIAlertView中代碼:
- (IBAction)showActionSheetReset:(id)sender
{
UIAlertView *resetAlertView = [[UIAlertView alloc] initWithTitle:@"Delete And Reset Score"
message:@"Are You sure You Want To Reset The Score Shown on the Engligh Page? This WILL NOT affect your High Score on Game Center."
delegate:self
cancelButtonTitle:@"No, Don't Erase"
otherButtonTitles:@"Yes, Reset Score", nil];
[resetAlertView show];
resetAlertView.tag = 2;
}
- (void)alertViewReset:(UIAlertView *)alertViewReset clickedButtonAtIndex: (NSInteger)buttonIndex
{
if (alertViewReset.tag == 2) {
if (buttonIndex == 1) {
[self resetTheScore];
}
}
}
這裏是我的resetTheScore
方法:
- (IBAction)resetTheScore
{
self.currentScore = 0;
currentScoreLabel.text = [NSString stringWithFormat:@"%lld", self.currentScore];
[self counterDefaults:self];
}
,這裏是我的counterDefaults
方法:
- (IBAction)counterDefaults:(id)sender
{
NSUserDefaults *Defaults = [NSUserDefaults standardUserDefaults];
[Defaults setInteger:self.currentScore forKey:TapCount];
[Defaults synchronize];
}
爲什麼不把它保存?
我想知道這是怎麼編譯缺少的結束引號... – 2013-02-10 20:31:12
什麼缺失報價 – imackid 2013-02-11 00:53:47