Iphone Access rootviewcontroller from subviews
I h开发者_运维问答ave a navigation based application, from any of my subUIviewcontrollers when they click a button on the toolbar, I want to send rootviewcontroller the checked rowId or entered text. So I want to manage everything from Rootviewcontroller(e.g which page to show next)
But this code below does not hit the answeredValues in my rootcontroller, even gives a warning that it might not respond. why is that? and if there is a better way to this things like from delegete class?
in interface
-(void)answerValues:(NSMutableArray*)values;
in implementation
-(void) answerValues:(NSMutableArray*)values {
//get answer value
//edit insert xml with new answer
//make connection
//Get XML
//Parse and get the last page of questions
//Return a variable object filled with question and answers
}
RootViewController *root = (RootViewController*)[self.navigationController.viewControllers objectAtIndex:0] ;
[root answerValues:values];
As I commented above, you mispelled the name of the method. In the original question, you called a method named answeredValues
, but in your updated question your method is named answerValues
.
精彩评论