Select Page

Did you know that you can control which View Controller will be seen first in your iPhone app? This video will show you how to do this.

What’s really useful with this tip is if you are trying to troubleshoot an issue with your iPhone app and it is the third view controller that has the issue. You can simply use this tip and select the third view controller as the one to start when you build your app. This will save you time by having to go through the other view controllers to get to the one that has the issue.

This tip is also useful if you do want to change the starting view controller in your iPhone app. It’s very easy to do in Xcode and I will show you how to do that in this video!

I hope you find this video useful for your iPhone app development and gives you a bit more knowledge on what an iOS Viewcontroller is and what you can do with it.

I am planning to start a new Udemy course on swift iOS development for beginners. I plan on covering all kinds of topics related to iOS development including iOS design patterns, navigation controllers, swift tableviews, segue, storyboards, and much more. Stay tuned for all of that info very soon. 

In his video I am going to show you about how to create your initial view controller for your iOS iPhone project. So let’s go ahead and fire up Xcode here and we will create a new project from scratch. We are going to select a single view app hit next, then we are going to call this project View Controller.

Okay and we will leave the team as my team designation organization name and, your bundle identifier is your reverse domain name so mine is at AppCoachSteve.Com so it’s com.AppCoachSteve and select Swift.  Leave each of these check boxes unchecked then click next.

Xcode is asking me where I want to put it and I will put the project, and it will be saved right here in my Xcode folder. So we are good to go. It’s always a good idea to start and build your project the when you start your project. After it finishes indexing it usually takes a couple seconds.  Once the simulator opens up it should and it should just be a blank iPhone looking app.  if you didn’t see I selected the iPhone 8 plus simulator in the upper left so the simulator is firing up its attaching the View controller.

Okay so we have a good starting spot here. So we will go and click on the main story board on the left here and we have our initial view controller that we get out of the box and what we’re going to do is going to come over here to the controls and select another view controller and drop it onto the storyboard.

Let me bump this down a little bit so you can see this better. It’s a little hard to see but I am going to change the background property here then go to other and we will select kind of a green color. Okay good and then for the second view controller I’m going to select the background color for this. 

I’ll select other and then this will be blue. Then I want to get a label another. Quick tip instead of kind of scrolling down through this and trying to find the controls you can actually type in what you’re looking for here in the bottom. So I’m looking for a label so there it is label and I’m going to grab this and put that in my first view controller.

Okay and then I want another label on my second view controller. Good and then let’s go back to the first view controller here I’m going to make this a little bit bigger and and then under the settings  I’m going to center it and then I will bump up the font to about 50. Then I’m going to make this a little bit bigger.

I will put in number one, okay so you know that is the first view controller which is green and then I’m going to basically do the same thing here for the second one. The blue kind of came out a little bit more like a purple but that’s okay. Then I’m going to basically do the same thing here for the second one the blue kind of came out a little bit looking more like a purple but that’s okay okay I’m stretching out the label and make it a little bit bigger here okay I am going to send her it’s and again I will change the font size to about 50 that’s good and double-clicked I’m going to call this number two.  

Now you see this little arrow that indicates on the storyboard which is the initial view controller and what you can actually do is if you click on the little yellow circle thing here, I don’t know what this is technically called but, it’s actually the selection for the view controller and there’s a a property here under the View controller section that says is initial view controller. So that means when your project starts it’s going to fire this view controller.

Let’s save this and hit the start button and I want to show you this. After this fire is up what we will do is will switch over to the second view controller so you actually see that.

Okay so it’s starting up there with the green number one. So let’s stop this stop okay and then what will do is come over to the second view controller click on this little yellow circle thing. Let me move over a little over to the left so you can see it’s no longer on the first view controller. Let me save my changes and then lets it run and the second view controller should be the first thing that shows in the app now. See that, in that not cool?

So you can actually control which view controller is actually your startup for your project so that’s very cool. Okay so that’s about it for this video I also want to tell you about my new Udemy course that I just created about creating awesome screenshots and app icons. iI you click on the link below this video you will get an awesome discount on that. Okay thanks and we will see you on the next video.

Share This