ios - Swapping views and triggering a method in the other class -


I am using the storyboard and I want the user to click on a certain button (Swapweave Endridge method) , Then the scene changes another scene defined by the second view controller (second view) and then another fixed method present in the second view (MyMethod). I am using the code given below and it successfully takes me to another view .... But MyMethod is not called. How can I get this? ! Cheers

  - (IBAction) SwapViewAndTriggerMethod: (ID) this {UIViewController * controller = [self.storyboard instantiateViewControllerWithIdentifier: @ "SecondView_storyboard"]; [Self-present ViewController: Animated Controller: Yes Completed: Zero]; [Example FGS2 Controller MyMethod: Zero]; }  

This is an error I get: Warning: & lt; Second View_View controller: 0x13f634f60> whose view is not in the hierarchy window! Note: MyMethod calls a picker to select a photo and assigns it in an image view.

"Do not call the method that presents one controller from controller to another controller, Because as the error says, the view of the second view view controller is not yet in the window hierarchy. You can set a flag in SwapViewAndTriggerMethod: and use that in SwapViewAndTriggerMethod viewDidAppear: picker,

 To present  - (IBAction) SwapViewAndTriggerMethod: (ID) this {SecondView_ViewController * Controller = [Self. Storyboard Immediate VisualizationReference Identifier: @ "SecondView_Storeboard"]; [Self-present ViewController: Animated Controller: Yes Completed: Zero]; Controller presentPicker = Yes; // presentPicker is a BOOL property that you need to add to SecondView_ViewController}  

Then, in the SecondView_ViewController, do this,

  - (zero ) ViewDidAppear: (BOOL) animated [[Super Viewedapper: Animated]; If (self.presentPicker) // present here to your selector self.presentPicker = NO; }  

Comments

Popular posts from this blog

import - Python ImportError: No module named wmi -

Editing Python Class in Shell and SQLAlchemy -

c# - MySQL Parameterized Select Query joining tables issue -