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