Adding a UIButton to our first project

9m 3s
Profileimage

Eliot Arntz

Eliot regularly teaches iOS development classes and workshops at General Assembly and guest lectures for companies and development boot camps around NYC. He also coaches... Read more

Adding a UIButton to your First Project.

For reference, the code that was written to change the label's text is as follows:

  • (void)buttonPressed

{

self.titleLabel.text = @"Hello Class!";

}

You will learn what all of this means shortly! But for know, notice how the statement between the curly braces sounds somewhat similar to English. This is not by mistake, but instead a characteristic of Objective-C, the programming langugage in which most iPhone apps are written in.

The dot notation signifies "ownership" and can be read as "self's titleLabel's text is equal to Hello Class." Right now, the word "self" sounds a little goofy but bear with me- it's another way of saying "My."