M
M
MonsterAndrew2019-02-19 14:43:51
Swift
MonsterAndrew, 2019-02-19 14:43:51

How to change UIViewController inside modal window?

Good afternoon. I'm making an application with a login page using Swift 4 and Xcode 10. On the main page of the application, I have 2 buttons: login and register. On clicking any of them, I present the modal with

navigationController?.present(LoginScreen(), animated: false)
. On the LoginScreen() page, I have a login form and a button. If the login is successful, then I do
navigationController?.pushViewController(MainScreen(), animated: false)
but already from the modal window.
The problem is that pushViewControllerfor some reason it does not work from a modal window , although if you call it from a page with buttons, then everything works fine. The login page just stays there.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
D
doublench21, 2019-02-19
@doublench21

Because normally it should look like this:
Button1
---> present [LogInVC]
------> present [NavigationController]
---------> push [UserFeedVC]
Button2
---> present [SignInVC]
------>present [NavigationController]
--------->push [UserFeedVC]

B
briahas, 2019-02-28
@briahas

In the normal version:
- the modal window closes, sending MainScreen info about the login result
- MainScreen pushes/presents what is needed
Remember student, Modalka-does-not-present. (c) KVN KhAI

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question