When I try to call the getter methods "gender" and "teamName" from another class (by creating an instance of the TeamsViewController class and calling the methods on that instance), the methods return null. Why is this?
Thanks for your help.
@interface TeamsViewController () {
NSString *teamName;
NSString *gender;
}
@end
- (void)viewDidLoad
{
[super viewDidLoad];
// Do any additional setup after loading the view.
gender = @"boys";
teamName = @"Basketball";
}
-(NSString *)gender {
NSLog(@"returning %@",gender);
return gender;
}
-(NSString *)teamName {
NSLog(@"returning %@",teamName);
return teamName;
}
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
if (onBoys==true) {
gender = @"boys";
}
else {
gender = @"girls";
}
[self performSegueWithIdentifier:@"teamsPushSegue" sender:self];
}
TeamsViewController *teamsInstance = [[TeamsViewController alloc]init];
[teamsInstance gender];