UITabBarController's viewControllers present modal controller issue
up vote
0
down vote
favorite
I have a UITabBarController with 4 viewControllers setup.
One of the controller has a button that present another controller (wrapped on UINavigationController) with the following setup:
self.definesPresentationContext = true
navController.modalPresentationStyle = .overCurrentContext
navController.modalTransitionStyle = .crossDissolve
self.present(navController, animated: true)
Until this point is working fine.
Now if I switch to another tab (while the previous modal is open), and return again to the tab that presented the modal (The screen is still there, that's ok). Then if i close the modal (from a Button), the modal is dismissed but the controller view's has gone (white), then if I switch to another tab and return to the tab again, the view load correctly.
Note: For this case, I need overCurrentContext
, don't want to block UITabBarController (with fullScreen
).. Also try with .currentContext
, custom
ios swift uiviewcontroller uimodalpresentationstyle
add a comment |
up vote
0
down vote
favorite
I have a UITabBarController with 4 viewControllers setup.
One of the controller has a button that present another controller (wrapped on UINavigationController) with the following setup:
self.definesPresentationContext = true
navController.modalPresentationStyle = .overCurrentContext
navController.modalTransitionStyle = .crossDissolve
self.present(navController, animated: true)
Until this point is working fine.
Now if I switch to another tab (while the previous modal is open), and return again to the tab that presented the modal (The screen is still there, that's ok). Then if i close the modal (from a Button), the modal is dismissed but the controller view's has gone (white), then if I switch to another tab and return to the tab again, the view load correctly.
Note: For this case, I need overCurrentContext
, don't want to block UITabBarController (with fullScreen
).. Also try with .currentContext
, custom
ios swift uiviewcontroller uimodalpresentationstyle
I believe this is a well-known bug.
– matt
Jun 8 at 16:51
@matt actually was reading your book (I took as coobook :) and was waiting you for answer ).. Thanks for comment. Any idea?
– José Roberto Abreu
Jun 8 at 16:53
If it's the same bug, I give my workaround, which is to prevent the user from doing that — i.e. the user cannot switch to another tab while the modal is open. See github.com/mattneub/Programming-iOS-Book-Examples/blob/master/…
– matt
Jun 8 at 16:56
@matt Select your answer as correct, for mentioning that this is a known bug.. In my case, I can't force the TabBar (due to UX) from switching. As a workaround, I did the following: Dismiss the presented controller when the Tab is switched and the modalPresentationStyle is .overCurrentContext.
– José Roberto Abreu
Jun 8 at 19:42
That's good too, obviously! Equally valid. You might give that as an alternate answer, for the record.
– matt
Jun 8 at 19:44
add a comment |
up vote
0
down vote
favorite
up vote
0
down vote
favorite
I have a UITabBarController with 4 viewControllers setup.
One of the controller has a button that present another controller (wrapped on UINavigationController) with the following setup:
self.definesPresentationContext = true
navController.modalPresentationStyle = .overCurrentContext
navController.modalTransitionStyle = .crossDissolve
self.present(navController, animated: true)
Until this point is working fine.
Now if I switch to another tab (while the previous modal is open), and return again to the tab that presented the modal (The screen is still there, that's ok). Then if i close the modal (from a Button), the modal is dismissed but the controller view's has gone (white), then if I switch to another tab and return to the tab again, the view load correctly.
Note: For this case, I need overCurrentContext
, don't want to block UITabBarController (with fullScreen
).. Also try with .currentContext
, custom
ios swift uiviewcontroller uimodalpresentationstyle
I have a UITabBarController with 4 viewControllers setup.
One of the controller has a button that present another controller (wrapped on UINavigationController) with the following setup:
self.definesPresentationContext = true
navController.modalPresentationStyle = .overCurrentContext
navController.modalTransitionStyle = .crossDissolve
self.present(navController, animated: true)
Until this point is working fine.
Now if I switch to another tab (while the previous modal is open), and return again to the tab that presented the modal (The screen is still there, that's ok). Then if i close the modal (from a Button), the modal is dismissed but the controller view's has gone (white), then if I switch to another tab and return to the tab again, the view load correctly.
Note: For this case, I need overCurrentContext
, don't want to block UITabBarController (with fullScreen
).. Also try with .currentContext
, custom
ios swift uiviewcontroller uimodalpresentationstyle
ios swift uiviewcontroller uimodalpresentationstyle
asked Jun 8 at 16:50
José Roberto Abreu
3117
3117
I believe this is a well-known bug.
– matt
Jun 8 at 16:51
@matt actually was reading your book (I took as coobook :) and was waiting you for answer ).. Thanks for comment. Any idea?
– José Roberto Abreu
Jun 8 at 16:53
If it's the same bug, I give my workaround, which is to prevent the user from doing that — i.e. the user cannot switch to another tab while the modal is open. See github.com/mattneub/Programming-iOS-Book-Examples/blob/master/…
– matt
Jun 8 at 16:56
@matt Select your answer as correct, for mentioning that this is a known bug.. In my case, I can't force the TabBar (due to UX) from switching. As a workaround, I did the following: Dismiss the presented controller when the Tab is switched and the modalPresentationStyle is .overCurrentContext.
– José Roberto Abreu
Jun 8 at 19:42
That's good too, obviously! Equally valid. You might give that as an alternate answer, for the record.
– matt
Jun 8 at 19:44
add a comment |
I believe this is a well-known bug.
– matt
Jun 8 at 16:51
@matt actually was reading your book (I took as coobook :) and was waiting you for answer ).. Thanks for comment. Any idea?
– José Roberto Abreu
Jun 8 at 16:53
If it's the same bug, I give my workaround, which is to prevent the user from doing that — i.e. the user cannot switch to another tab while the modal is open. See github.com/mattneub/Programming-iOS-Book-Examples/blob/master/…
– matt
Jun 8 at 16:56
@matt Select your answer as correct, for mentioning that this is a known bug.. In my case, I can't force the TabBar (due to UX) from switching. As a workaround, I did the following: Dismiss the presented controller when the Tab is switched and the modalPresentationStyle is .overCurrentContext.
– José Roberto Abreu
Jun 8 at 19:42
That's good too, obviously! Equally valid. You might give that as an alternate answer, for the record.
– matt
Jun 8 at 19:44
I believe this is a well-known bug.
– matt
Jun 8 at 16:51
I believe this is a well-known bug.
– matt
Jun 8 at 16:51
@matt actually was reading your book (I took as coobook :) and was waiting you for answer ).. Thanks for comment. Any idea?
– José Roberto Abreu
Jun 8 at 16:53
@matt actually was reading your book (I took as coobook :) and was waiting you for answer ).. Thanks for comment. Any idea?
– José Roberto Abreu
Jun 8 at 16:53
If it's the same bug, I give my workaround, which is to prevent the user from doing that — i.e. the user cannot switch to another tab while the modal is open. See github.com/mattneub/Programming-iOS-Book-Examples/blob/master/…
– matt
Jun 8 at 16:56
If it's the same bug, I give my workaround, which is to prevent the user from doing that — i.e. the user cannot switch to another tab while the modal is open. See github.com/mattneub/Programming-iOS-Book-Examples/blob/master/…
– matt
Jun 8 at 16:56
@matt Select your answer as correct, for mentioning that this is a known bug.. In my case, I can't force the TabBar (due to UX) from switching. As a workaround, I did the following: Dismiss the presented controller when the Tab is switched and the modalPresentationStyle is .overCurrentContext.
– José Roberto Abreu
Jun 8 at 19:42
@matt Select your answer as correct, for mentioning that this is a known bug.. In my case, I can't force the TabBar (due to UX) from switching. As a workaround, I did the following: Dismiss the presented controller when the Tab is switched and the modalPresentationStyle is .overCurrentContext.
– José Roberto Abreu
Jun 8 at 19:42
That's good too, obviously! Equally valid. You might give that as an alternate answer, for the record.
– matt
Jun 8 at 19:44
That's good too, obviously! Equally valid. You might give that as an alternate answer, for the record.
– matt
Jun 8 at 19:44
add a comment |
1 Answer
1
active
oldest
votes
up vote
1
down vote
accepted
If this is the same bug that I demonstrate here, the workaround I give is to prevent the user from switching to another tab while this tab is showing the presented view controller:
override func viewDidLoad() {
super.viewDidLoad()
self.tabBarController?.delegate = self
}
extension FirstViewController : UITabBarControllerDelegate {
func tabBarController(_ tabBarController: UITabBarController, shouldSelect viewController: UIViewController) -> Bool {
return self.presentedViewController == nil
}
}
add a comment |
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
1
down vote
accepted
If this is the same bug that I demonstrate here, the workaround I give is to prevent the user from switching to another tab while this tab is showing the presented view controller:
override func viewDidLoad() {
super.viewDidLoad()
self.tabBarController?.delegate = self
}
extension FirstViewController : UITabBarControllerDelegate {
func tabBarController(_ tabBarController: UITabBarController, shouldSelect viewController: UIViewController) -> Bool {
return self.presentedViewController == nil
}
}
add a comment |
up vote
1
down vote
accepted
If this is the same bug that I demonstrate here, the workaround I give is to prevent the user from switching to another tab while this tab is showing the presented view controller:
override func viewDidLoad() {
super.viewDidLoad()
self.tabBarController?.delegate = self
}
extension FirstViewController : UITabBarControllerDelegate {
func tabBarController(_ tabBarController: UITabBarController, shouldSelect viewController: UIViewController) -> Bool {
return self.presentedViewController == nil
}
}
add a comment |
up vote
1
down vote
accepted
up vote
1
down vote
accepted
If this is the same bug that I demonstrate here, the workaround I give is to prevent the user from switching to another tab while this tab is showing the presented view controller:
override func viewDidLoad() {
super.viewDidLoad()
self.tabBarController?.delegate = self
}
extension FirstViewController : UITabBarControllerDelegate {
func tabBarController(_ tabBarController: UITabBarController, shouldSelect viewController: UIViewController) -> Bool {
return self.presentedViewController == nil
}
}
If this is the same bug that I demonstrate here, the workaround I give is to prevent the user from switching to another tab while this tab is showing the presented view controller:
override func viewDidLoad() {
super.viewDidLoad()
self.tabBarController?.delegate = self
}
extension FirstViewController : UITabBarControllerDelegate {
func tabBarController(_ tabBarController: UITabBarController, shouldSelect viewController: UIViewController) -> Bool {
return self.presentedViewController == nil
}
}
answered Jun 8 at 16:57
matt
318k44513716
318k44513716
add a comment |
add a comment |
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f50765226%2fuitabbarcontrollers-viewcontrollers-present-modal-controller-issue%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
I believe this is a well-known bug.
– matt
Jun 8 at 16:51
@matt actually was reading your book (I took as coobook :) and was waiting you for answer ).. Thanks for comment. Any idea?
– José Roberto Abreu
Jun 8 at 16:53
If it's the same bug, I give my workaround, which is to prevent the user from doing that — i.e. the user cannot switch to another tab while the modal is open. See github.com/mattneub/Programming-iOS-Book-Examples/blob/master/…
– matt
Jun 8 at 16:56
@matt Select your answer as correct, for mentioning that this is a known bug.. In my case, I can't force the TabBar (due to UX) from switching. As a workaround, I did the following: Dismiss the presented controller when the Tab is switched and the modalPresentationStyle is .overCurrentContext.
– José Roberto Abreu
Jun 8 at 19:42
That's good too, obviously! Equally valid. You might give that as an alternate answer, for the record.
– matt
Jun 8 at 19:44