Cocoa Development
... an introduction
by Lieven Dekeyser
Previous sessions
- Cocoa development on Mac
- Foundation
- AppKit
- Xcode
- Interface Builder
- Most of it is very similar on iPhone
Part 3
- UIKit
- Navigation
- Animation
- Distribution
UIKit
- Equivalent to AppKit
- Built from the ground up for the iPhone:
- Multi-Touch
- Small screen
- Limited resources
- Basic User Interface components (UIButton, UILabel,...)
- Access to accelerometer, pasteboard, touch events,...
- Complex UI components (UIImagePickerController, UIWebView,...)
Structure of an iPhone app
- Model-View-Controller
- Model: All yours!
- View: UITextField, UIButton, UITableView,...
-
Controller: UIViewController
- Every screen has its view controller
- Standard view controllers: UITableViewController, UIImagePickerController,...
- Navigation: UINavigationController, UITabBarController
Structure of the Netlog iPhone app
- Tab Bar
-
Navigation Controller
- HomeViewController : UITableViewController
-
Navigation Controller
- FriendsViewController: custom view controller that happens to control a table view (and more)
-
Navigation Controller
- PhotosMenuController : UITableViewController
- Push: PhotosSlideShowController: custom view controller
- Modal: UIImagePickerController
-
Navigation Controller
- ShoutsViewController : UITableViewController
-
Navigation Controller
- MessagesViewController : UITableViewController
Example: Bookmarks TableView
Animation
- UIKit is built on top of CoreAnimation
- On small-screen devices, animation is almost necessary
- Property changes (location, visibility,...) can be easily animated
- Example: Moving Labels
Distribution
- Development with simulator = free
- Run on device => iPhone Developer Program (80 euro/year)
- Code signing certificate
- Provisioning profiles: list of devices your code is allowed to run on
- Ad hoc distribution: limited
- More devices? Submit to the app store