dismiss

single function to dismiss all open view controllers

拈花ヽ惹草 提交于 2019-11-26 13:00:53
问题 I have an app which is a single view application. I have a navigation controller linked up to all child controllers from the root view controller. In each child controller, I have a logout button. I\'m wondering if I can have a single function I can call which will dismiss all the controllers which have been open along along the way, no matter which controller was currently open when the user presses logout? My basic start: func tryLogout(){ self.dismissViewControllerAnimated(true, completion

Receive result from DialogFragment

戏子无情 提交于 2019-11-26 01:46:27
问题 I am using DialogFragments for a number of things: choosing item from list, entering text. What is the best way to return a value (i.e. a string or an item from a list) back to the calling activity/fragment? Currently I am making the calling activity implement DismissListener and giving the DialogFragment a reference to the activity. The Dialog then calls the OnDimiss method in the activity and the activity grabs the result from the DialogFragment object. Very messy and it doesn\'t work on