开发者

NavigationController synchronizing execution of subviews with higher level view

I am using NavigationController to provide differ开发者_JAVA百科ent views. In one case I want to use a ChildView to get some data from the user and return that data to the ParentView. The parent view uses the pushViewController method from within an (IBAction) method as it responds to a selection on a SegmentedController: that is the different buttons on the SegmentedController push different child views. The problem seems to be that the pushViewController method forks a new process and the ParentView keeps on executing the IBAction without waiting for the ChildView to return: i.e. after ChildView viewWillAppear is called. Here is the sequence from my NSLog file which shows this happening. The question is how can I ensure that the Parent waits until after the Child has finished before trying to access the data.

eventAction: Child selected
ChildView: initWithNibName called
ChildView: viewDidLoad called
ParentView: viewWillDisappear called
ChildView: viewWillAppear called
ParentView: eventAction: after pushing ChildView: data = 0
ChildView: numberOfRowsInSection called
ParentView: viewDidDisappear called
ChildView: viewDidAppear called
ChildView: pickerView: didSelectRow: data = 3
ChildView: viewWillDisappear called
ParentView: viewWillAppear called
ChildView: viewDidDisappear called
ParentView: viewDidAppear called
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜