0
我這一段代碼:變量不採取正確的值
- (void)ShowTypeOfExercises:(id)sender
{
NSString *lstrGroupTitle;
NSString *lstrGroupNumber;
if(([sender tag]) == 1)
{
lstrGroupTitle = NSLocalizedString(@" Chest", @"");
lstrGroupNumber = @" 1";
}
.
.
.
.
[lstrGroupNumber release];
[lstrGroupTitle release];
Exercises *objExercises = [[Exercises alloc] initWithNibName:@"Exercises" bundle:nil];
[self.navigationController pushViewController:objExercises animated:YES];
}
此代碼塊工作正常,我第一次點擊它,但在第二次點擊它總是崩潰。它崩潰,因爲,令人驚訝的是,lstrGroupTitle獲得了一個奇怪的值。如何在這個簡單的功能中獲得錯誤的價值?
注意:lstrGroupNumber正常工作。