Documentos de Académico
Documentos de Profesional
Documentos de Cultura
Jean-Luc David
CTO, Digiflare Inc
Agenda
Project Structure
Design Patterns & Architecture
Storing Data
Coding Conventions
Model-View-Controller
Controller
Coordination
Update
Controller
Model
Model
Data
Changes
Update
Changes
View
View
Display
Default Project
Notice Classes is a
catch-all default
bucket for code
AppDelegate
Controllers
Helpers
Models
View
Display/Event Capture/Visual Appeal
Dont try to reinvent UIKit, use it
Controller
Coordination/Delegation/Odd Jobs
Transitions, Startup/Shutdown
Controller
Model
Update
View
Controller
Update
Model
View
Network
Access
Multiple
Choices
Commit
Social View
Settings View
Home
Controller
Social
Controller
Settings
Controller
Home Model
Social Model
Settings
Model
Loose Coupling
Dont skip MVC layers when messaging
Use controllers to coordinate messages
Dont mix MVC roles in one object
Dont gather too much work in one place
Dont declare data in your view classes
Maintenance nightmare
You can display data in a view, just dont
store it
Communication Between
Objects
Target-Action
Reuse controls
without subclassing
Target
UIButton
Notification
Broadcast changes
Delegation
Control reuse
Yes
Observe
r
Observe
r
UIKeyboar
d
Software
keyboard
setTarget:(id)target action:(SEL)action
about to appear!
NSNotificationCenter
Delegat
e
UITextFiel
d
End Editing?
You Dont!
Use the UISplitViewController
Dont try to reinvent the wheel
UIKit has a lot of the base controls you
need
Really question whether you need a custom
control (and if it exists already)
Dont misuse framework classes
ie Removing views from UIViewControllers
Dont try to reinvent the way models, views &
controllers talk to each other
Use delegates & notifications
void)scrollViewDidScroll:(UIScrollView *)scrollView
if ([scrollView isKindOfClass:[UITableView class]}){
// do something
} else {
// use UIScrollView logic
iPad
Parcel out your
controllers
View
View
Controller
Controller
Model
Model
View
Controll
er
View
View
View
View
Controll
Controll
er Controll er
er
Model
Model
View
Controll
er
Model
Model
Model
iPad App
MVC Structure
Update
Controller
Change
Inspector
Change
Model
Toolbar
Update
Controller
Property Lists
Archives
Custom Files
Server/iCloud/APIs
SQLite
CoreData
Property Lists.
CoreData
Modeling Tools
Simple save/restore
Queries
Data Protection
Ordered Relationships
UIManagedDocument
Partial Graphs
Undo
Incremental Stores
ect
CoreData again.
Custom Files.
For easily
serializing and
deserializing
objects in a data file.
Property Lists
Archives
Custom Files
Server/iCloud/APIs
SQLite
CoreData
Coding Conventions
What is KVO?
Controller
Model
Conclusions