Big Nerd Ranch iOS Training Day 3
Book: Vol. 1 iOS Programming Instructor by Scott Ritchie
Today we mainly covered three topics. We learned how to use the Interface Builder, putting elements on to it and etc. On the topic of Interface Builder, we also learned how to "ctrl + drag" elements in .xib files to and from the File Owner, setting up Outlets and Delegates.
We then moved on to how Objective-C would work without ARC. We learned that most of the time if we see an alloc, we basically would need to either release or autorelease. On a side note, this topic was by far the most confusing of them all.
The third topic we covered was how to work with Core Location and MapKit APIs. We created an app which found our current location and allowed us to put an annotation on the mapview.
Lastly, I learned today that you do not need a pointer to a struct. An example of this would be CLLocationCoordinate2D.
MVC - Model, View, Controller
Views - things you can see in the App
Views can be nested and can be a part of a hierarchy
Controller - knows how to build and setup the view
Would probably not want to have lots of initializers
Would probably want lots of initializers
Stay the heck out of here
cmd + option + (1-4) - switch between attribute inspector
“Files Owner” in .xib file
“ctrl + drag” = message from view controller to specific view (ex: UIButton)
“ctrl + drag” the way the message goes on runtime
IBAction - tells the interface builder this is a action that is available in the view controller
Target/Action: Target: whatever you drag to, Action: whatever you drag to
dot - is already implemented
dash - is implemented by someone else
IBOutlet - telling the .xib loading system to set value to something in the view
Connection Inspector - inspect the “Files Owner” to see all the connections or right click on the “Files Owner”
***Important*** Page: 17 - Suggestions/Rules in iOS Programming Training Slides
A class can have zero or more initializers
One initializer is deemed “Designated”
All initializers call designated initializer
Designated initializer calls superclass’s designated initializer
Must override superclass’s designated initializer
More info: Chapter 2 (Page: 31) - Initializers in iOS Programming
There is only 1 designated initializer in the class!!!
there is no way in Objective-C to tell ppl about what is the designated initializer
they call the designated initializer with “self”
Always turn on ARC! But… if you don’t turn it on below is what you need…
Note: You can turn off ARC on the file level
Without ARC, its all about pattern matching
Ups the retain count by 1
Lowers the retain count by 1
Lower the retain count by 1… later
Cannot call this directly, call - release
only do stuff if you see one of the following within the same class:
Build -> Analyze to look at potential memory leaks
Page 29 in iOS Programming Training Slides
setDesiredAccuracy - the more accurate, the longer it will take to locate
startUpdatingLocation - this is non-blocking
In XCode, you can simulate the different locations
The keyboard, TextInputTrait
Happens in “TextInput” and “TextField”