Tag Archives: Xcode hints

XCode Beginner Tutorial 1

Here’s a basic introduction to Xcode.

We will create a project using the Xcode single view template. Then utilise the storyboard feature to create our Graphical User Interface (GUI) and connect the GUI elements to our header file that was created by default as part of the template. We add a UIButton together with a UILabel.

The UIButton is connected as an IBAction, that means we connect it to our code as an actionable button, when it’s pressed we want it to perform a task. The UILabel is connected as an IBOutlet. This means that it is there to serve as an outlet for our code, in other words it will react to a certain set of commands.¬†When we press the UIButton, we will print some text to the UILabel to display on the screen.

Next we add an additional UIButton that will be used to transition from the first UIViewController to the second which we add using the interface builder and storyboard. We then set the button and the UILabel to be hidden when the view appears and then create a simple animation to display them on the screen when we press the button.

Next we add a second UIViewController to the storyboard and also create the relevant .h (header) and .m (implementation) files that go with the new controller. The UIViewController is then connected to this code. Another UIButton is connected as an IBAction method and we add a line of code to transition back to our previous view.

The project file can be downloaded here