我運行我的應用程序,它會添加分數,但不會在我點擊它後放置塊的位置。現在Xcode 7 [Objective-c]方法衝突?
- (IBAction)Block:(id)sender{
Random = arc4random() %219;
Random = Random + 61;
BlockI.center = CGPointMake(0, Random);
BlockB.center = CGPointMake(0, Random);
[self Score];
}
- (void)Score{
ScoreInt = ScoreInt + 1;
Score.text = [NSString stringWithFormat:@"%li", (long)ScoreInt];
[[NSUserDefaults standardUserDefaults] setInteger:ScoreInt forKey:@"ScoreSaved"];
}
如果我刪除的部分:
[self Score];
和
- (void)Score{
ScoreInt = ScoreInt + 1;
Score.text = [NSString stringWithFormat:@"%li", (long)ScoreInt];
[[NSUserDefaults standardUserDefaults] setInteger:ScoreInt forKey:@"ScoreSaved"];
}
然後我得到的塊的隨機位置,但是當我點擊它的成績不會增加。
-Thanks, 德里克
scoreint價值了嗎? –
scrore.text whats getting printed –
@KishoreKumar是的[viewDidLoad]我把「ScoreInt = 0;」 –