I have recently started to learn iOS with obj-c from "iOS Programming The Big Nerd Ranch Guide 4th Edition". This edition was released in 2014 and is written with Xcode 5.
I am trying to make a simple app with two buttons and two labels. The labels are connected to two arrays and when a button is pressed an object from the corresponding array is shown in the corresponding text label (it's the Quiz app in chapter 1).
I created the project as a Single View app in Xcode 6, and put all my objects in the view controller class. I have two labels two buttons two arrays and an int to keep track of the object that has to be displayed from the array.
In the book it says that I should initialize the arrays in the initWithNibName
method. I tried that but for some reason it never gets called. So I changed the initialization of the arrays to the init
method. They initialize fine but when they are called from another method they are nil
. Do you have any idea why this is happening?
The second issue I'm having is that I can't manage to get the contents of the storyboard on screen. It says that I'm supposed to make an instance of the ViewController
inside the AppDelegate
and make it the root window controller but all I get is a white window (or black in case I don't set the color).
UPDATE: I changed the intialization of the arrays from the init
method to the viewDidLoad
method and now they seem to be working fine. Nothing on the screen though.