我正在设计一个老虎机项目,其中有高分页面的第二个视图。大多数情况下,除了将老虎机从老虎机传递到高分页之外,所有的东西都可以工作。这里是我的方法的代码老虎机内:将值从一个类传递到另一个类
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];
}
还是新的,在这一点,所以让我知道你认为!谢谢!
哪里是如果(赢得== YES)这种说法? – saadnib 2011-04-06 16:23:08
在我的IBAction中称为spin,每当用户点击一个按钮时调用。它让我的老虎机旋转并播放声音和东西。这是所有功能,我需要知道的是如何将字符串从一个类传递到另一个 – SForemann 2011-04-07 14:36:46
,这是所有功能* – SForemann 2011-04-07 14:37:08