passing data back to a previously allocated UIViewController

后端 未结 3 1637
傲寒
傲寒 2021-01-28 05:18

I have a view controller that then has a button that passes to an option menu.

When options are set they need to be past back to the previously allocated viewcontroller.

3条回答
  •  梦如初夏
    2021-01-28 06:17

    You can achieve this by using a delegate protocol. First view controller should become the delegate of the second view controller and then you can call this delegate method in your first view controller once the selection is done.

    You can lookup google for implementation of delegates in objective-c. Its pretty simple. Add a

    @protocol 
    
    @end
    

    Create a member variable in the second view controller for assigning the delegate. And define the method in the class implementing the delegate.

提交回复
热议问题