Questions tagged [rootviewcontroller]

145 questions
71
votes
16 answers

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

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:…
Krunal
  • 77,632
  • 48
  • 245
  • 261
70
votes
6 answers

Changing root view controller of a iOS Window

Is the root view controller of a iOS Window usually initialized once in the beginning to a tab bar controller or navigation controller? Is it okay to change the root view controller multiple times within an app? I have a scenario where the top view…
Anna
  • 945
  • 1
  • 9
  • 13
29
votes
4 answers

How can I get the rootViewController of UINavigationController

I want to get the rootViewController of UINavigationController. It works in Objective-c, but when I use it in Swift , the error reminds me that it was wrong. Code screenshot 1. If I do this, add as! NSArray, it works, but also reminds me that "cast…
Remsay
  • 321
  • 1
  • 3
  • 4
22
votes
1 answer

Xcode 11.2.1 - Swift 5 - Can't change main storyboard "Main" to another storyboard "Start"

I have created a new storyboard named "Start.storyboard", but when I change Main Interface to "Start" nothing happened, The app just started with default storyboard "Main.storyboard". I'm using Xcode 11.2.1 and iOS 13.2.3 Also I have tried to…
6
votes
4 answers

How to set Root View Controller programatically in Objective C?

I am a newbie in iOS Development trying to learn how to create and set views programmatically. i am trying to do swift statement in Obj-C window?.rootViewController = UINavigationController(rootViewController : ViewController()) Project: Single…
ios
  • 165
  • 1
  • 11
5
votes
2 answers

Setting UINavigationController's navigation bar and rootViewController in the same time

I am facing a dilemma trying to set a UINavigationController's rootView UIViewController and UINavigationBar in the same time. It seems that a UINavigationController can be either initiated with a rootViewController as so: let navController =…
4
votes
1 answer

How to pass rootViewController to Google sign-in in SwiftUi?

This is my first question here after years of finding every answer I needed. I have coded some apps for iPhone in IOS, I'm not always sure of what I'm doing but they work! They use Google sign in and it's working fine. Now I want to code an app for…
Frank
  • 41
  • 3
4
votes
2 answers

How to get rid of message " 'windows' was deprecated in iOS 15.0: Use UIWindowScene.windows on a relevant window scene instead" with AdMob banner?

I want to get rid of the " 'windows' was deprecated in iOS 15.0: Use UIWindowScene.windows on a relevant window scene instead" message in my function (my function works very well by the way.). The line of code involved: banner.rootViewController =…
Flincorp
  • 751
  • 9
  • 22
4
votes
1 answer

What is rootViewController & when do I use it?

while integrating a payment gateway in my iOS app, I used rootViewController property as below: UIStoryboard *storyboard = [UIStoryboard storyboardWithName:@"Main" bundle:nil]; UINavigationController *controller = [storyboard…
ios_Dev
  • 95
  • 1
  • 10
3
votes
3 answers

Is there a way to view a UIViewController behind another UIViewController without messing with the AppDelegate window?

There is a library I really enjoy that you could find here (https://github.com/pixyzehn/MediumMenu). Essentially it does the following: The menu in the back is actually a UIViewController. If we delve into the source code, we'll find the following…
David
  • 7,028
  • 10
  • 48
  • 95
2
votes
1 answer

How to detect if button was pressed after app restart in swift?

I am trying to determine if user selected the "reset" button after the app restarts. With this code, it will go back to the root controller when the app is open or in the background. Once I terminate the app and re-open, the app is still as if the…
2
votes
3 answers

when need to switch the rootViewController

I've been working on a Swift project and I have two view controllers, the login view controller & the home view controller. When a user launches the app, I want to display the login view controller if the user is not logged in, on the other hand, if…
Yuuu
  • 715
  • 1
  • 9
  • 32
2
votes
1 answer

SignUp Button Not Working While Handling RootViewController?

I'm building an iOS app using a Storyboard. The root view controller is a Home View Controller. I'm creating the login/logout process, and it's mostly working fine, but I've got a few issues. I need to know the BEST way to set all this up. When I…
iFateh
  • 570
  • 2
  • 6
  • 22
2
votes
1 answer

Change rootviewcontroller after logout

I have used SceneDelegate to change the rootviewcontroller after login action. It works fine but when I logout I am not able to perform navigation again. Here is my code for Scenekit: let status = UserDefaults.standard.bool(forKey:…
ios
  • 955
  • 1
  • 12
  • 35
2
votes
1 answer

Adding UITabBarController and have no NavigationController

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.…
1
2 3
9 10