iOS100
iOS Platform Development Introduction
Day 4
Last time in iOS100...
We further explored:
-
Objective-C Review
- Objects
- Using Instances
- Creating Objects
- Sending Messages
RandomItems
-
Created a command line tool
-
Created and populate arrays with objects
-
Iterated though our arrays
-
Subclassed an Objective-C class (NSObject)
-
Overrode parent class methods
-
Implemented out own custom Initializers
-
Implement class and instance methods
- Implemented properties for our instance varables
Quiz
What is the difference between the following two method calls?
// Create a variable that will point to an NSMutableArray Object...
NSMutableArray *myParty;
myParty = [NSMutableArray alloc];
VS
?
Class vs Instance Methods
- Instance Methods
- Operates on a particular instance of a class
- Invoked by sending a message to a specific instance of a class
- Denoted by a "-" in the method declaration
- Class Methods
- Typically creates a new instance of the class or retrieves a global property of the class.
- Invoked by sending a message to the class itself
- Denoted by a "+" in the method declaration
Quiz
What are two different ways we can iterate though an array?
Practice
-
Create a mutable party array object that contains the following:
- Output all of the values inside of the array
- Manually
- Traditional for loop
- Fast enumeration
Quiz
What is overriding a method?
Practice
Override the description method of a class to return the string
"I control you!"
Todays Agenda
- Create a prime number calculator
- Building user interfaces
- Simple Controls
- Interacting with controls from a class
- Error handling