I realize this is a dumb beginner question, but I have been stuck for at least an hour on trying to get an integer value from my array to display on a label when I press a button. The problem is that the label keeps displaying "(null)" no matter what index I put the label to look at. I have tried taking out the quotation marks on the NSArray objects too. It doesn't matter too much whether the objects within the NSArray are integers or strings, but I would at least like to know the syntax on how to put them into the array because I believe that's my problem. If not, show me otherwise please.
My code: (.h file)
@property (strong, nonatomic) NSArray *redOneTeams;
(.m file)
- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{
self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
if (self) {
// Custom initialization
_redOneTeams = @[
@"4351",
@"4298",
];
}
return self;
}
- (IBAction)saveBtn:(id)sender {
_teamNumber.text = [[NSString alloc] initWithFormat: @"%@", [_redOneTeams objectAtIndex:0]];
}