ios - How can I programmatically unwind 5 controllerViews without a navigation controller? -


i 5 views deep, there no navigation controller binding them. cannot use poptorootviewcontrolleranimated because have no navigation controller. go initial view controller of storyboard, , callback method available after dismiss complete?

objective-c implementation

implement function in appdelegate or in other util class

- (void)custompoptorootviewcontroller {      uiviewcontroller *topcontroller = [uiapplication sharedapplication].keywindow.rootviewcontroller;     //if using method inside appdelegate write self.window.rootviewcontroller      nsmutablearray *presentedviewcontrollers = [nsmutablearray array];     while (topcontroller.presentedviewcontroller) {          [presentedviewcontrollers addobject:topcontroller.presentedviewcontroller];         topcontroller = topcontroller.presentedviewcontroller;     }      (uiviewcontroller *vc in presentedviewcontroller) {          [vc dismissviewcontrolleranimated:yes completion:nil];     } }    

and in current view controller call function.

[(appdelegate*)[uiapplication sharedapplication].delegate custompoptoptorootviewcontroller]; 

Popular posts from this blog

c# - ODP.NET Oracle.ManagedDataAccess causes ORA-12537 network session end of file -

matlab - Compression and Decompression of ECG Signal using HUFFMAN ALGORITHM -

utf 8 - split utf-8 string into bytes in python -