ハイスコア ページの 2 番目のビューを持つスロット マシン プロジェクトを設計しています。ほとんどの場合、スロット マシンからハイ スコア ページへの勝者のパスを除いて、すべてが機能しています。スロットマシン内のメソッドのコードは次のとおりです。
if(win == YES) {
NSString *msg = nil;
if(playerField.text.length > 0) {
msg = [[NSString alloc] initWithFormat:@"%@", playerField.text];
}
NSLog(@"DEBUG");
[(HighScorePage *)self.view addNewHighScore:msg];
[self performSelector:@selector(playWinSound) withObject:nil afterDelay:.5];
[msg release];
}
そして、HighScorePage の addNewHighScore メソッドは次のとおりです。
-(void)addNewHighScore:(NSString *)player {
NSMutableArray *tempArray = [[NSMutableArray alloc] init];
int i = 0;
for (NSArray *count in dynPlayerArray) {
[tempArray addObject:[NSIndexPath indexPathForRow:i++ inSection:0]];
}
[tempArray addObject:player];
[[self highScores] beginUpdates];
[[self highScores] insertRowsAtIndexPaths:(NSArray *)tempArray withRowAnimation:UITableViewRowAnimationNone];
[[self highScores] endUpdates];
[tempArray release];
}
これはまだ新しいので、あなたの考えを教えてください!ありがとう!