how can i get the currently active view (the main view currently being viewed by the user) from the app delegate for references sake?
相关问题
- CALayer - backgroundColor flipped?
- Core Data lightweight migration crashes after App
- How can I implement password recovery in an iPhone
- State preservation and restoration strategies with
- “Zero out” sensitive String data in Swift
相关文章
- 现在使用swift开发ios应用好还是swift?
- UITableView dragging distance with UIRefreshContro
- TCC __TCCAccessRequest_block_invoke
- Where does a host app handle NSExtensionContext#co
- xcode 4 garbage collection removed?
- Unable to process app at this time due to a genera
- Swift - hide pickerView after value selected
- How can I add media attachments to my push notific
you can use
[appDelegate.navigationController.topViewController class]
to log the class of the controller or get the title property to know which one it is.All top answers doesn't work with modal presented views! Use this code instead:
UIView * topView = [[[[UIApplication sharedApplication] keyWindow] subviews] lastObject];
Hope this helps you
Anywhere in the app you can get your rootViewController View also like that:
Try Eric's answer:
It depends on how your app is set up.
Typically, your app delegate will have a main view controller property that will let you get to it.
To get your app delegate
If your app has a navigation controller property in the app delegate you can do something like this.