I am having difficulty with numbers when programming my iphone app. I want to pass a number (and possibly eventually an array) from one view controller to another. I have managed to do this will strings but I just can't figure it out with numbers. This is what I have..
PrimaryViewController.h
@interface PrimaryTimerViewController : UIViewController {
IBOutlet UITextField *name;
int *number;
}
-(IBAction)submit;
@end
PrimaryViewController.m
-(void)submit{
SecondaryTimerViewController *Second = [SecondaryTimerViewController alloc];
Second.name = name.text;
Second.number = 5; //causes an error
[self.view addSubview:Second.view];
}
SecondaryViewController.h
@interface SecondaryTimerViewController : UIViewController {
IBOutlet UILabel *secondaryLabel;
NSString *name;
int *number;
}
@property (nonatomic, retain) NSString *name;
@property (nonatomic) int number;
@end
SecondaryViewController.m
- (void)viewDidLoad {
secondaryLabel.text = name;
int num = number; //gives a cast warning
[super viewDidLoad];
}
If anyone could shed some light on this that would be fantastic. I am new to this and have been googling it for hours :-(