September 2013
Intermediate to advanced
112 pages
2h 42m
English
The iOS APIs include many standard UIView subclasses. Some add intricate functionality, while others are merely ornamental. UIButton is one such view, and it does exactly what it sounds like. Let’s add it to our app and see how it works.
UIButtons are created differently than normal UIViews. Instead of using alloc.initWithFrame, UIButtons are initialized using the static method UIButton.buttonWithType:. We pass an integer option, usually UIButtonTypeSystem or UIButtonTypeCustom, and get a new button. Many iOS APIs use verbose integer constants like these because more idiomatic Ruby Symbols don’t exist in the original Objective-C. Anyhow, take a look at how we add our button in AppDelegate.
Read now
Unlock full access