Xamarin.iOS – Replacing Storyboard with UIViewControllers

In this lesson

  • Remove generated Storyboard
  • Update AppDelegate to use our UIViewController as RootViewController

Transcript

Tap on time to skip ahead

00:00

I’m going to delete this main storyboard. I’m going to obliterate it. We’re going to get rid of the storyboard that was originally generated for us by Xamarin. We are going to create a new view controller with what is know as a nib. I hit New File, select iOS, I want an iPhone ViewController. If you read the description up here, “A custom class and an Interface Builder document for creating an iPhone View Controller.”

00:33

We’re going to start building the real UI for our Pomodoro timer app. I’m going to call this TimerViewController. I’m going to pull some code from somewhere else here. When the app finished launching, when it gets done showing that loading screen, this method in our app delegate gets invoked called FinishedLaunching.

00:54

We have this reference to a UIWindow. We created a new UIWindow and we say, “we want the window’s bounds, it’s width and height, to equal UIScreen.MainScreen.Bounds.” Then every window, every UIWindow, has a RootViewController. If you’re going to be going from multiple screens, one to the next, you’ll want your root view controller to be a navigation controller. Because in our application, we’re basically going to have one screen for now, we don’t need that.  We’re just going to add the view controller that we created as our Root View Controller.

01:33

Lastly, we tell the window to make it key and visible. Key is like saying bring it to the forefront. Now let’s try this. There you go!