i am new to ios. I need to know the current view controller from app delegate.. i have no idea about this and i don't knowto implement this. i am using this code toimplemnt this but it return null values. I followed this link- Get current view controller from the app delegate (modal is possible) need help.
相关问题
- 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
It depends on how you set up your UI. You can possibly get your rootViewController and move through the hierarchy if it is set up in such a way.
Here're some class/static functions in swift that I keep in a Utility class and can help you:
Swift version of jjv360's great answer, (I got rid of some redundant returns, and I think Swift is more readable)
From you AppDelegate,
Swift 4.0 Global Alert function:-
1.Make A Separate Util .swift class and give name FCommonUtils.swift :-
2. Use it anywhere like this in side view controllers or from UI Objects :-
This is the simple and easiest way to implement global alert feature inside iOS Apps. Happy Coding!! ;)
This helped me to find the visible view controller. I searched for existing methods and didn't find any. So I wrote my own custom one.
And sample use :
I get the root controller and then iterate through presented VC's: