简体   繁体   中英

UIViewController viewDidAppear after dismiss?

I have an app that uses a storyboard. I am going from the "main view controller" to the others using standard segues, and I am dismissing the other viewControllers with dismissViewController. (note, they are mostly being displayed in form sheet).

Thing is, when it returns to the main view controller, I need to do some cleanup (clear out arrays, reload a tableview and so on). How would I go about doing this, since i cannot use viewDidLoad or viewDidAppear?

I think the best solution it is add block (for example closeActionBlock) for your presented controller and call this block when you hide controller. (How it is implement you can see in Objective-C Block Property with Xcode code completion )

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM