iPhone UINavigationController Passing Parameter Back To Main View
i m new to stackoverflow and this is my first question. My question is : I have a UINavigationController and have a UITableView inside it. I pass parameter t开发者_运维问答o another view when a cell is clicked in tableview with didSelectRowAtIndexPath method, and i show the cell information in a label in another view which I called SecondViewController. Inside SecondViewController i have another label and i want to pass it's value to the selected cell's subvalue. As a conclusion i want to pass a value back to navigationcontroller's mainview.
Thanks for all your incoming responses. Regards, ae
would suggest you to use the delegate concept to sorted out you probelm...
Check the useful SO link .
How do I create delegates in Objective-C?
How does a delegate work in objective-C?
Delegation pattern
In your secondviewcontroller, the method which was called for popping to the main controller,inside that method pass the value to the mainview property.
For e.g.
One view :---mainview
Second View : secondcontroler
Now Inside secondcontroller:--
-(void)getbacktomainview
{
mainview *mn ;
mn.someproperty = yourvalue;
[navigationController popViewControllerAnimated:YES];
}
Hope it helps you.....
精彩评论