我正在尝试在我准备加载的视图上设置一个变量。下面是设置它的代码:
NSInteger amountOfQuestions = [self.questions.text intValue];
Timer_ViewController *tvc = [[Timer_ViewController alloc] initWithNibName:@"Timer_ViewController" bundle:nil];
tvc.amountOfQuestions = &amountOfQuestions;
这是@interface Timer_ViewController
:
@interface Timer_ViewController : UIViewController
{
NSInteger amountOfQuestions;
}
@property (nonatomic) NSInteger *amountOfQuestions;
@end
我对objective-c相对较新,因此指出明显的设计缺陷将不胜感激。