ios - recalling and displying NSString -


hello im sure can answer bugging hell out of because being stupid.

i have array , can store didselectrowatindexpath row , nslog formatselected. pop view controller , desplay formatselected botton title.

- (void)tableview:(uitableview *)tableview didselectrowatindexpath:(nsindexpath *)indexpath {     nsstring *formatselected = [[nsstring alloc]init];     formatselected:[format objectatindex:indexpath.row];     nslog(@"this format selected %@",formatselected);     [button2 settitle:[format objectatindex:indexpath.row] forstate:uicontrolstatenormal];     [navigationcontroler popviewcontrolleranimated:yes]; } 

that works fine.

my problem is, in previous view newly titled button have button , label.

i want able press second button , display formatselected string in label or nslog

-(ibaction)printresults{ nsstring *fmat = [[nsstring alloc]initwithformat:@"%@",formatselected]; nslog(@"%@",fmat);     nslog(@"nslong button pressed");} 

but nslog displays (null)?

i have @property (nonatomic, retain) nsstring *formatselected; , synthesized it.

what doing wrong?

you declaring formatselected local variable in method tableview:didselectrowatindexpath:. assign formatselected within method cease accessible after method exits. assigning selected format local variable instead of property (and corresponding instance variable).

use [self setformatselected:[format objectatindex:indexpath.row]]; , remove nsstring *formatselected... line entirely.


Comments

Popular posts from this blog

c# - SVN Error : "svnadmin: E205000: Too many arguments" -

c# - Copy ObservableCollection to another ObservableCollection -

All overlapping substrings matching a java regex -