Hello Im sure you all can answer this but its bugging the hell out of my because i am being stupid.
I have an array and can store the didSelectRowAtIndexPath
row and then NSLog formatSelected. I then pop the view controller and desplay the formatSelected as the botton title.
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
NSString *formatSelected = [[NSString alloc]init];
formatSelected:[format objectAtIndex:indexPath.row];
NSLog(@"this is the format selected %@",formatSelected);
[button2 setTitle:[format objectAtIndex:indexPath.row] forState:UIControlStateNormal];
[navigationControler popViewControllerAnimated:YES];
}
That works fine.
My problem is, in the previous view where the newly titled button is I have another button and a label.
I want to be able to press the second button and display the formatSelected String in the label or NSLog it
-(IBAction)printResults{
NSString *fmat = [[NSString alloc]initWithFormat:@"%@",formatSelected];
NSLog(@"%@",fmat);
NSLog(@"nslong button pressed");}
But the NSLog just displays (null)?
I have @property (nonatomic, retain) NSString *formatSelected;
and synthesized it.
What am I doing wrong?