rootviewcontroller

Changing rootViewController doesn't display viewController set as root

可紊 提交于 2021-02-11 15:05:40
问题 I have an initialViewController, if I find user login information, I route user to Home, but if I don't, I set register/login ViewController as root. I tested with break points that my register/login ViewController didLoad and didAppear getting execute, but my register/login ViewController don't show and initialViewController remains on screen. this is my code: public static func setRootViewController(withId id: String, storyBoardName: String) { let mainStoryboard: UIStoryboard = UIStoryboard

Changing rootViewController doesn't display viewController set as root

帅比萌擦擦* 提交于 2021-02-11 15:04:37
问题 I have an initialViewController, if I find user login information, I route user to Home, but if I don't, I set register/login ViewController as root. I tested with break points that my register/login ViewController didLoad and didAppear getting execute, but my register/login ViewController don't show and initialViewController remains on screen. this is my code: public static func setRootViewController(withId id: String, storyBoardName: String) { let mainStoryboard: UIStoryboard = UIStoryboard

Set rootViewController programmatically not working, picking initial view controller from storyboard only in Xcode 11

二次信任 提交于 2021-01-29 16:20:35
问题 Trying to change the root view controller programmatically, initially in storyboard as initial view controller is checked. Every time same viewController is opened which is set up as initialViewController in storyboard. Please guide. Sharing below what code tried so far: let isLoggedIn = UserDefaults.standard.bool(forKey: kIsLoggedIn) if isLoggedIn{ //Welcome Screen for Touch ID let storyboard = UIStoryboard(name: "Main", bundle: nil) // let rootVC = storyboard.instantiateViewController

assigning a custom destination to popToRootViewController swift 4

亡梦爱人 提交于 2021-01-29 10:37:47
问题 I am using navigationController?.popToRootViewController(animated: true) to dismiss my current view to the previous view. My view controller relationship looks like this. VC1->VC2 VC1->VC3 VC3->VC2 Whenever the client is in VC2 I want to pop the navigation controller back to VC1. This works fine when the rootviewcontroller is set to VC1. However, when the client uses a segue from VC3 to enter VC2, the rootviewcontroller is set to VC3 and the navigation controller pops to VC3. I tried to

viewDidLoad called twice, using navigation controller

徘徊边缘 提交于 2020-03-05 05:35:07
问题 My ViewDidLoad method on a ViewController is called twice, but only in a particular scenario. There are two view controllers which I need to present, one if user isn't logged in and the second if the user is logged in. I am using storyboard and have set a navigation controller as initial view controller in it. In my AppDelegate didFinishLaunchingWithOptions method I have populated ViewControllers array with the desired controller as below let storyboard = UIStoryboard(name: "Main", bundle:

iOS 13: Swift - 'Set application root view controller programmatically' does not work

旧城冷巷雨未停 提交于 2020-01-10 18:44:06
问题 I have following code in my AppDelegate.swift to setup root view controller for an iOS application. But it does not work. It follows Target structure (defined under General tab) and ignores this code. (Xcode 11, Swift 5.1, iOS 13) class AppDelegate: UIResponder, UIApplicationDelegate { var window: UIWindow? func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool { window = UIWindow(frame: UIScreen.main.bounds)

Is rootViewController always ready to present a segue by the time application:didBecomeActive is called (iOS)?

放肆的年华 提交于 2020-01-03 05:38:20
问题 My app has a rootViewController setup in a storyboard. I originally asked this question, but I can see that it is the wrong question to ask now: Is the viewDidLoad method of the rootViewController always called before application:didBecomeActive in the app delegate? Does that viewDidLoad method always finish before application:didBecomeActive is called, or can the two run concurrently? I can run tests, but I know that these tests don't take into account every situation. I want to understand

How to present login screen only when a userdefaults key doesn't exist?

折月煮酒 提交于 2019-12-23 02:57:06
问题 I am trying to develop an application (still learning) where i present a logon screen which takes a username and password - this then goes off to a web service to authenticate and returns an access token. The access token is then stored in userdefaults and then presents a new view controller which gives access to the secured data. My problem is that when i close my app - force close, it then asks to login again. Because my login view controller is the initial view controller then i added a

Adding UITabBarController and have no NavigationController

那年仲夏 提交于 2019-12-12 10:10:04
问题 As I'm new in Xamarin.IOS, I'd like to ask a question. I've followed this example for adding UITabBarController in a Xamarin.IOS project. When I initialized RootViewController by an instance of TabController, it works fine and I have all tabs. BUT my NavigationController set null ! it means that : NavigationItem will disappear navigating between viewControllers are not possible by this code : this.NavigationController.PushViewController(new ProfileViewController(), true); because the

Trigger an event / method when UIWindow RootViewController changes SWIFT

删除回忆录丶 提交于 2019-12-11 01:56:43
问题 I'm working on an iOS framework. I have a requirement to log events when user enters or exits a particular View Controller. For that I was thinking if somehow I could be able to register a notification to trigger a custom method when the root view controller changes. Or perhaps use KVO. But I don't understand how to do this from an implementation point of view since I cannot find any such notification. Any help in this regard would be highly appreciated. Thanks. Please note that this is a