I have a tab bar based app. There are navigation controllers in all 5 tabs with instances of custom view controller setup properly as root view controllers. This loads just
As per @Y.Bonafons comment, In Swift, You can try like this, (for Swift 4.x & 5.0)
DispatchQueue.main.async {
self.showAction() //Show what you need to present
}
You should display it modally from your root vc (e.g: customTabBarRootViewController). save a reference, and use the reference controller to display it.
If you call present(:animated:completion:) in tableView(:didSelectRowAt:), selectionStyle == .none for selected tableview cell and you’ve got this strange behavior then try to call tableView.deselectRow(at:animated:) before any operations in tableView(_:didSelectRowAt:).
Did it help?
Swift 4: you can use as below.
DispatchQueue.main.async {
let popUpVc = Utilities.viewController(name: "TwoBtnPopUpViewController", onStoryboard: "Login") as? TwoBtnPopUpViewController
self.present(popUpVc!, animated: true, completion: nil)
}
It works for me.
I guess you also set the cell's selectionStyle to UITableViewCellSelectionStyleNone
. I change to UITableViewCellSelectionStyleDefault
and it work perfect.
Solution in Swift 3
In the SampleSelectorViewController(the presented view controller) use the below code
DispatchQueue.global(qos: .background).async {
// Write your code
}