using and customizing cocoa bindings - progsocwhophd/stavros/416-slides.pdfcontroller model...
TRANSCRIPT
![Page 1: Using and Customizing Cocoa Bindings - ProgSocwhophd/stavros/416-slides.pdfController Model AVppKiewit Glue Code Foundation Core Data Cocoa Bindings Note: this slide has a build whose](https://reader033.vdocuments.us/reader033/viewer/2022050902/5adbba697f8b9aee348e702e/html5/thumbnails/1.jpg)
Movie to come
Session 416
Using and Customizing Cocoa Bindings
![Page 2: Using and Customizing Cocoa Bindings - ProgSocwhophd/stavros/416-slides.pdfController Model AVppKiewit Glue Code Foundation Core Data Cocoa Bindings Note: this slide has a build whose](https://reader033.vdocuments.us/reader033/viewer/2022050902/5adbba697f8b9aee348e702e/html5/thumbnails/2.jpg)
Ron Lue-SangGlue Code Architect
Using and Customizing Cocoa Bindings
![Page 3: Using and Customizing Cocoa Bindings - ProgSocwhophd/stavros/416-slides.pdfController Model AVppKiewit Glue Code Foundation Core Data Cocoa Bindings Note: this slide has a build whose](https://reader033.vdocuments.us/reader033/viewer/2022050902/5adbba697f8b9aee348e702e/html5/thumbnails/3.jpg)
• Overview of Cocoa Bindings• New features• Tips and tricks– Roll your own bindings
Agenda
![Page 4: Using and Customizing Cocoa Bindings - ProgSocwhophd/stavros/416-slides.pdfController Model AVppKiewit Glue Code Foundation Core Data Cocoa Bindings Note: this slide has a build whose](https://reader033.vdocuments.us/reader033/viewer/2022050902/5adbba697f8b9aee348e702e/html5/thumbnails/4.jpg)
Controller
Model
ViewAppKit
Glue Code
Foundation Core Data
Cocoa Bindings
Note: this slide has a build whose order must be retained
Model View Controller
![Page 5: Using and Customizing Cocoa Bindings - ProgSocwhophd/stavros/416-slides.pdfController Model AVppKiewit Glue Code Foundation Core Data Cocoa Bindings Note: this slide has a build whose](https://reader033.vdocuments.us/reader033/viewer/2022050902/5adbba697f8b9aee348e702e/html5/thumbnails/5.jpg)
FileMerge Testimonial
![Page 6: Using and Customizing Cocoa Bindings - ProgSocwhophd/stavros/416-slides.pdfController Model AVppKiewit Glue Code Foundation Core Data Cocoa Bindings Note: this slide has a build whose](https://reader033.vdocuments.us/reader033/viewer/2022050902/5adbba697f8b9aee348e702e/html5/thumbnails/6.jpg)
MVC the Cocoa Way• Re-usable controller classes• Binding – Attribute of one object– Property of another
DataObject
DataObject
DataObject
DataObject
DataObject
NSArrayController
Array
Content
Text Field
Value binding
selection.name
![Page 7: Using and Customizing Cocoa Bindings - ProgSocwhophd/stavros/416-slides.pdfController Model AVppKiewit Glue Code Foundation Core Data Cocoa Bindings Note: this slide has a build whose](https://reader033.vdocuments.us/reader033/viewer/2022050902/5adbba697f8b9aee348e702e/html5/thumbnails/7.jpg)
Technology Base for Cocoa Bindings
Key Value BindingKey Value ObservingKey Value Coding
Cocoa Bindings
Key Value Coding Key Value Observing Key Value Binding
![Page 8: Using and Customizing Cocoa Bindings - ProgSocwhophd/stavros/416-slides.pdfController Model AVppKiewit Glue Code Foundation Core Data Cocoa Bindings Note: this slide has a build whose](https://reader033.vdocuments.us/reader033/viewer/2022050902/5adbba697f8b9aee348e702e/html5/thumbnails/8.jpg)
Key Value Coding- (id)valueForKey:(NSString *)key- (void)setValue:(id)value forKey:(NSString *)key
M V
CKVCKV
C
![Page 9: Using and Customizing Cocoa Bindings - ProgSocwhophd/stavros/416-slides.pdfController Model AVppKiewit Glue Code Foundation Core Data Cocoa Bindings Note: this slide has a build whose](https://reader033.vdocuments.us/reader033/viewer/2022050902/5adbba697f8b9aee348e702e/html5/thumbnails/9.jpg)
Key Value Observing- (void) addObserver:(NSObject *)observer forKeyPath:(NSString *)keyPath
options:(NSKeyValueObservingOptions)options context:(void *)context
selection.name
M V
CKVOKV
O
![Page 10: Using and Customizing Cocoa Bindings - ProgSocwhophd/stavros/416-slides.pdfController Model AVppKiewit Glue Code Foundation Core Data Cocoa Bindings Note: this slide has a build whose](https://reader033.vdocuments.us/reader033/viewer/2022050902/5adbba697f8b9aee348e702e/html5/thumbnails/10.jpg)
Key Value Observing- (void)observeValueForKeyPath:(NSString *)keyPath
ofObject:(id)object change:(NSDictionary *)change context:(void *)context;
M V
CKVOKV
O
selection.name
![Page 11: Using and Customizing Cocoa Bindings - ProgSocwhophd/stavros/416-slides.pdfController Model AVppKiewit Glue Code Foundation Core Data Cocoa Bindings Note: this slide has a build whose](https://reader033.vdocuments.us/reader033/viewer/2022050902/5adbba697f8b9aee348e702e/html5/thumbnails/11.jpg)
Key Value Binding- (void) bind:(NSString *)binding toObject:(id)observable withKeyPath:(NSString *)keyPath options:(NSDictionary *)options
M
C
V
KVBKVB
VKVB
![Page 12: Using and Customizing Cocoa Bindings - ProgSocwhophd/stavros/416-slides.pdfController Model AVppKiewit Glue Code Foundation Core Data Cocoa Bindings Note: this slide has a build whose](https://reader033.vdocuments.us/reader033/viewer/2022050902/5adbba697f8b9aee348e702e/html5/thumbnails/12.jpg)
Edit Cycle• Key Value Coding
M V
CsetValueFor
KeyPath:setVa
lueFor
KeyPa
th:
![Page 13: Using and Customizing Cocoa Bindings - ProgSocwhophd/stavros/416-slides.pdfController Model AVppKiewit Glue Code Foundation Core Data Cocoa Bindings Note: this slide has a build whose](https://reader033.vdocuments.us/reader033/viewer/2022050902/5adbba697f8b9aee348e702e/html5/thumbnails/13.jpg)
Edit Cycle• Key Value Observing
M V
C
observe
Value
ForKey
Path
:
V2observeValue
ForKeyPath:
![Page 14: Using and Customizing Cocoa Bindings - ProgSocwhophd/stavros/416-slides.pdfController Model AVppKiewit Glue Code Foundation Core Data Cocoa Bindings Note: this slide has a build whose](https://reader033.vdocuments.us/reader033/viewer/2022050902/5adbba697f8b9aee348e702e/html5/thumbnails/14.jpg)
Binding in Interface Builder
![Page 15: Using and Customizing Cocoa Bindings - ProgSocwhophd/stavros/416-slides.pdfController Model AVppKiewit Glue Code Foundation Core Data Cocoa Bindings Note: this slide has a build whose](https://reader033.vdocuments.us/reader033/viewer/2022050902/5adbba697f8b9aee348e702e/html5/thumbnails/15.jpg)
Demo
![Page 16: Using and Customizing Cocoa Bindings - ProgSocwhophd/stavros/416-slides.pdfController Model AVppKiewit Glue Code Foundation Core Data Cocoa Bindings Note: this slide has a build whose](https://reader033.vdocuments.us/reader033/viewer/2022050902/5adbba697f8b9aee348e702e/html5/thumbnails/16.jpg)
New Features in Tiger
![Page 17: Using and Customizing Cocoa Bindings - ProgSocwhophd/stavros/416-slides.pdfController Model AVppKiewit Glue Code Foundation Core Data Cocoa Bindings Note: this slide has a build whose](https://reader033.vdocuments.us/reader033/viewer/2022050902/5adbba697f8b9aee348e702e/html5/thumbnails/17.jpg)
Controllers• NSTreeController– NSOutlineView– NSBrowser• Filtering NSArrayController– No subclassing needed
![Page 18: Using and Customizing Cocoa Bindings - ProgSocwhophd/stavros/416-slides.pdfController Model AVppKiewit Glue Code Foundation Core Data Cocoa Bindings Note: this slide has a build whose](https://reader033.vdocuments.us/reader033/viewer/2022050902/5adbba697f8b9aee348e702e/html5/thumbnails/18.jpg)
Tree Controller
![Page 19: Using and Customizing Cocoa Bindings - ProgSocwhophd/stavros/416-slides.pdfController Model AVppKiewit Glue Code Foundation Core Data Cocoa Bindings Note: this slide has a build whose](https://reader033.vdocuments.us/reader033/viewer/2022050902/5adbba697f8b9aee348e702e/html5/thumbnails/19.jpg)
NSTreeController• Like NSArrayController and arrays– Manages a tree of objects• Your data’s tree structure– NSArrays in KVC objects in NSArrays
NSArray
children
ModelObject
ModelObject
ModelObject
ModelObject
ModelObject
ModelObject
NSArray
NSArray
children
childrenNSArray
NSArray
children
ModelObject
![Page 20: Using and Customizing Cocoa Bindings - ProgSocwhophd/stavros/416-slides.pdfController Model AVppKiewit Glue Code Foundation Core Data Cocoa Bindings Note: this slide has a build whose](https://reader033.vdocuments.us/reader033/viewer/2022050902/5adbba697f8b9aee348e702e/html5/thumbnails/20.jpg)
NSTreeController• Describe your tree– childrenKey– Optional– countKey– leafKey
• Change your tree– insert:– add:– insertChild:– addChild:– remove:
![Page 21: Using and Customizing Cocoa Bindings - ProgSocwhophd/stavros/416-slides.pdfController Model AVppKiewit Glue Code Foundation Core Data Cocoa Bindings Note: this slide has a build whose](https://reader033.vdocuments.us/reader033/viewer/2022050902/5adbba697f8b9aee348e702e/html5/thumbnails/21.jpg)
NSTreeController• Setting controller content– contentObject binding– contentObject outlet• Controller Keys– arrangedObjects– selection– canInsertChild– canAddChild– selectionIndexPaths
![Page 22: Using and Customizing Cocoa Bindings - ProgSocwhophd/stavros/416-slides.pdfController Model AVppKiewit Glue Code Foundation Core Data Cocoa Bindings Note: this slide has a build whose](https://reader033.vdocuments.us/reader033/viewer/2022050902/5adbba697f8b9aee348e702e/html5/thumbnails/22.jpg)
NSIndexPath• Identifier for trees• Similar to index of array• Represents a path of indexes
(2, 4, 9)
![Page 23: Using and Customizing Cocoa Bindings - ProgSocwhophd/stavros/416-slides.pdfController Model AVppKiewit Glue Code Foundation Core Data Cocoa Bindings Note: this slide has a build whose](https://reader033.vdocuments.us/reader033/viewer/2022050902/5adbba697f8b9aee348e702e/html5/thumbnails/23.jpg)
NSTreeController• NSOutlineView column bindings– Like columns in NSTableView
![Page 24: Using and Customizing Cocoa Bindings - ProgSocwhophd/stavros/416-slides.pdfController Model AVppKiewit Glue Code Foundation Core Data Cocoa Bindings Note: this slide has a build whose](https://reader033.vdocuments.us/reader033/viewer/2022050902/5adbba697f8b9aee348e702e/html5/thumbnails/24.jpg)
NSTreeController• NSOutlineView bindings– content– selectionIndexPaths
![Page 25: Using and Customizing Cocoa Bindings - ProgSocwhophd/stavros/416-slides.pdfController Model AVppKiewit Glue Code Foundation Core Data Cocoa Bindings Note: this slide has a build whose](https://reader033.vdocuments.us/reader033/viewer/2022050902/5adbba697f8b9aee348e702e/html5/thumbnails/25.jpg)
NSTreeController• NSBrowser bindings– content– selectionIndexPaths– contentValues
![Page 26: Using and Customizing Cocoa Bindings - ProgSocwhophd/stavros/416-slides.pdfController Model AVppKiewit Glue Code Foundation Core Data Cocoa Bindings Note: this slide has a build whose](https://reader033.vdocuments.us/reader033/viewer/2022050902/5adbba697f8b9aee348e702e/html5/thumbnails/26.jpg)
NSOutlineView and NSBrowser•WWDC Caveat– No edit support via bindings
![Page 27: Using and Customizing Cocoa Bindings - ProgSocwhophd/stavros/416-slides.pdfController Model AVppKiewit Glue Code Foundation Core Data Cocoa Bindings Note: this slide has a build whose](https://reader033.vdocuments.us/reader033/viewer/2022050902/5adbba697f8b9aee348e702e/html5/thumbnails/27.jpg)
Filtering
NSArrayController, NSPredicate, NSSearchField
![Page 28: Using and Customizing Cocoa Bindings - ProgSocwhophd/stavros/416-slides.pdfController Model AVppKiewit Glue Code Foundation Core Data Cocoa Bindings Note: this slide has a build whose](https://reader033.vdocuments.us/reader033/viewer/2022050902/5adbba697f8b9aee348e702e/html5/thumbnails/28.jpg)
Filtering• NSArrayController• NSArray• Synergized! NSSearchField
![Page 29: Using and Customizing Cocoa Bindings - ProgSocwhophd/stavros/416-slides.pdfController Model AVppKiewit Glue Code Foundation Core Data Cocoa Bindings Note: this slide has a build whose](https://reader033.vdocuments.us/reader033/viewer/2022050902/5adbba697f8b9aee348e702e/html5/thumbnails/29.jpg)
NSPredicate• Courtesy of Core Data• Describes a condition
• NSArray filtering
• NSMutableArray filtering
(name == "Ron")(name beginsWith "R") && (occupation == "Jamaican")
- (NSArray *)filteredArrayUsingPredicate:(NSPredicate *)predicate
- (void)filterUsingPredicate:(NSPredicate *)predicate
![Page 30: Using and Customizing Cocoa Bindings - ProgSocwhophd/stavros/416-slides.pdfController Model AVppKiewit Glue Code Foundation Core Data Cocoa Bindings Note: this slide has a build whose](https://reader033.vdocuments.us/reader033/viewer/2022050902/5adbba697f8b9aee348e702e/html5/thumbnails/30.jpg)
NSArrayController Filtering• setFilterPredicate:
• filterPredicate controller key• Clears filter predicate on insertion• arrangedObjects represents the filtered content array– Doesn’t delete your objects
- (void)setFilterPredicate:(NSPredicate *)predicate
![Page 31: Using and Customizing Cocoa Bindings - ProgSocwhophd/stavros/416-slides.pdfController Model AVppKiewit Glue Code Foundation Core Data Cocoa Bindings Note: this slide has a build whose](https://reader033.vdocuments.us/reader033/viewer/2022050902/5adbba697f8b9aee348e702e/html5/thumbnails/31.jpg)
NSSearchField Bindings• recentSearches– Like Safari
![Page 32: Using and Customizing Cocoa Bindings - ProgSocwhophd/stavros/416-slides.pdfController Model AVppKiewit Glue Code Foundation Core Data Cocoa Bindings Note: this slide has a build whose](https://reader033.vdocuments.us/reader033/viewer/2022050902/5adbba697f8b9aee348e702e/html5/thumbnails/32.jpg)
NSSearchField Bindings• predicate (predicate2, predicate3, ...)– Like Mail
![Page 33: Using and Customizing Cocoa Bindings - ProgSocwhophd/stavros/416-slides.pdfController Model AVppKiewit Glue Code Foundation Core Data Cocoa Bindings Note: this slide has a build whose](https://reader033.vdocuments.us/reader033/viewer/2022050902/5adbba697f8b9aee348e702e/html5/thumbnails/33.jpg)
NSSearchField Bindings• predicate (predicate2, predicate3, ...)– Like Mail– Bind to arrayController.filterPredicate– 1 binding per menu item
NSDisplayNameBindingOptionNSPredicateFormatBindingOption
![Page 34: Using and Customizing Cocoa Bindings - ProgSocwhophd/stavros/416-slides.pdfController Model AVppKiewit Glue Code Foundation Core Data Cocoa Bindings Note: this slide has a build whose](https://reader033.vdocuments.us/reader033/viewer/2022050902/5adbba697f8b9aee348e702e/html5/thumbnails/34.jpg)
Core Data Integration
![Page 35: Using and Customizing Cocoa Bindings - ProgSocwhophd/stavros/416-slides.pdfController Model AVppKiewit Glue Code Foundation Core Data Cocoa Bindings Note: this slide has a build whose](https://reader033.vdocuments.us/reader033/viewer/2022050902/5adbba697f8b9aee348e702e/html5/thumbnails/35.jpg)
Core Data Support • Core Data support added to controllers– NSObjectController– NSArrayController
![Page 36: Using and Customizing Cocoa Bindings - ProgSocwhophd/stavros/416-slides.pdfController Model AVppKiewit Glue Code Foundation Core Data Cocoa Bindings Note: this slide has a build whose](https://reader033.vdocuments.us/reader033/viewer/2022050902/5adbba697f8b9aee348e702e/html5/thumbnails/36.jpg)
Core Data• You define a description of your data (model)– entity → class• NSManagedObjectContext– Manages object use (working set)– Manages object storage/retrieval• Fetch objects by entity– NSPredicate for which objects to fetch
![Page 37: Using and Customizing Cocoa Bindings - ProgSocwhophd/stavros/416-slides.pdfController Model AVppKiewit Glue Code Foundation Core Data Cocoa Bindings Note: this slide has a build whose](https://reader033.vdocuments.us/reader033/viewer/2022050902/5adbba697f8b9aee348e702e/html5/thumbnails/37.jpg)
NSControllers and Core Data• Define the entity of the controller– As opposed to object class• Define a fetch predicate– Not the same as filterPredicate• New bindings and outlets– managedObjectContext
• Creates a fetch request for you– Fetch automatically– fetch:
![Page 38: Using and Customizing Cocoa Bindings - ProgSocwhophd/stavros/416-slides.pdfController Model AVppKiewit Glue Code Foundation Core Data Cocoa Bindings Note: this slide has a build whose](https://reader033.vdocuments.us/reader033/viewer/2022050902/5adbba697f8b9aee348e702e/html5/thumbnails/38.jpg)
NSControllers and Core Data• Sort in the array controller• NSArrayController contentSet binding• KVO means we’re always in sync
![Page 39: Using and Customizing Cocoa Bindings - ProgSocwhophd/stavros/416-slides.pdfController Model AVppKiewit Glue Code Foundation Core Data Cocoa Bindings Note: this slide has a build whose](https://reader033.vdocuments.us/reader033/viewer/2022050902/5adbba697f8b9aee348e702e/html5/thumbnails/39.jpg)
Demo
![Page 40: Using and Customizing Cocoa Bindings - ProgSocwhophd/stavros/416-slides.pdfController Model AVppKiewit Glue Code Foundation Core Data Cocoa Bindings Note: this slide has a build whose](https://reader033.vdocuments.us/reader033/viewer/2022050902/5adbba697f8b9aee348e702e/html5/thumbnails/40.jpg)
Other New Features
![Page 41: Using and Customizing Cocoa Bindings - ProgSocwhophd/stavros/416-slides.pdfController Model AVppKiewit Glue Code Foundation Core Data Cocoa Bindings Note: this slide has a build whose](https://reader033.vdocuments.us/reader033/viewer/2022050902/5adbba697f8b9aee348e702e/html5/thumbnails/41.jpg)
Binding Debug Mode• Defaults write “NSBindingDebugLogLevel” 1• Help catch configuration errors– Error accessing, setting, invoking
![Page 42: Using and Customizing Cocoa Bindings - ProgSocwhophd/stavros/416-slides.pdfController Model AVppKiewit Glue Code Foundation Core Data Cocoa Bindings Note: this slide has a build whose](https://reader033.vdocuments.us/reader033/viewer/2022050902/5adbba697f8b9aee348e702e/html5/thumbnails/42.jpg)
Binding Info• Dictionary of information about a binding– NSObjectObservedKey—object bound to– NSObservedKeyPathKey—key path bound with– NSOptionsKey—dictionary of options
- (NSDictionary *)infoForBinding:(NSString *)binding
![Page 43: Using and Customizing Cocoa Bindings - ProgSocwhophd/stavros/416-slides.pdfController Model AVppKiewit Glue Code Foundation Core Data Cocoa Bindings Note: this slide has a build whose](https://reader033.vdocuments.us/reader033/viewer/2022050902/5adbba697f8b9aee348e702e/html5/thumbnails/43.jpg)
NSArrayController• Always use Multiple Selection Marker option– NSMultipleSelectionMarker– Performance optimization for LARGE, similar selections
![Page 44: Using and Customizing Cocoa Bindings - ProgSocwhophd/stavros/416-slides.pdfController Model AVppKiewit Glue Code Foundation Core Data Cocoa Bindings Note: this slide has a build whose](https://reader033.vdocuments.us/reader033/viewer/2022050902/5adbba697f8b9aee348e702e/html5/thumbnails/44.jpg)
New Bindings and Options
NSView toolTip
NSTextView attributedString
NSWindow displayPatternTitle
NSTableColumn Creates sort descriptor binding option
NSArrayController contentSet
![Page 45: Using and Customizing Cocoa Bindings - ProgSocwhophd/stavros/416-slides.pdfController Model AVppKiewit Glue Code Foundation Core Data Cocoa Bindings Note: this slide has a build whose](https://reader033.vdocuments.us/reader033/viewer/2022050902/5adbba697f8b9aee348e702e/html5/thumbnails/45.jpg)
NSPopup and NSMatrix Bindings• contentObjects• NSMatrix mode changes– Radio (Single selection)– selectedValue– selectedObject– List and Highlight (Multi selection)– selectedValues– selectedObjects
![Page 46: Using and Customizing Cocoa Bindings - ProgSocwhophd/stavros/416-slides.pdfController Model AVppKiewit Glue Code Foundation Core Data Cocoa Bindings Note: this slide has a build whose](https://reader033.vdocuments.us/reader033/viewer/2022050902/5adbba697f8b9aee348e702e/html5/thumbnails/46.jpg)
Tips and Tricks
Including rolling your own bindings
![Page 47: Using and Customizing Cocoa Bindings - ProgSocwhophd/stavros/416-slides.pdfController Model AVppKiewit Glue Code Foundation Core Data Cocoa Bindings Note: this slide has a build whose](https://reader033.vdocuments.us/reader033/viewer/2022050902/5adbba697f8b9aee348e702e/html5/thumbnails/47.jpg)
Roll Your Own Bindings
Make your Class Cocoa Bindings friendly
![Page 48: Using and Customizing Cocoa Bindings - ProgSocwhophd/stavros/416-slides.pdfController Model AVppKiewit Glue Code Foundation Core Data Cocoa Bindings Note: this slide has a build whose](https://reader033.vdocuments.us/reader033/viewer/2022050902/5adbba697f8b9aee348e702e/html5/thumbnails/48.jpg)
Your Model and Cocoa Bindings• KVC compliant attribute– KVC accessors– ivar access• KVO compliance– KVO auto-notification– Manual notification– willChangeValueForKeyPath:– didChangeValueForKeyPath:
• KVB exposing– exposeBinding:
![Page 49: Using and Customizing Cocoa Bindings - ProgSocwhophd/stavros/416-slides.pdfController Model AVppKiewit Glue Code Foundation Core Data Cocoa Bindings Note: this slide has a build whose](https://reader033.vdocuments.us/reader033/viewer/2022050902/5adbba697f8b9aee348e702e/html5/thumbnails/49.jpg)
Your View and Cocoa Bindings• KVB implementation– bind:toObject:withKeyPath:options:– unbind:• KVO support– Add yourself as an observer– Respond to observer message– observeValueForKeyPath:ofObject:change:context:
![Page 50: Using and Customizing Cocoa Bindings - ProgSocwhophd/stavros/416-slides.pdfController Model AVppKiewit Glue Code Foundation Core Data Cocoa Bindings Note: this slide has a build whose](https://reader033.vdocuments.us/reader033/viewer/2022050902/5adbba697f8b9aee348e702e/html5/thumbnails/50.jpg)
Editing Support• NSEditor (messages for you to respond to)– commitEditing– discardEditing• NSEditorRegistration (messages for you to send)– objectDidBeginEditing:– objectDidEndEditing:
![Page 51: Using and Customizing Cocoa Bindings - ProgSocwhophd/stavros/416-slides.pdfController Model AVppKiewit Glue Code Foundation Core Data Cocoa Bindings Note: this slide has a build whose](https://reader033.vdocuments.us/reader033/viewer/2022050902/5adbba697f8b9aee348e702e/html5/thumbnails/51.jpg)
Interface Builder Support• Build a palette– Promotes code reuse
![Page 52: Using and Customizing Cocoa Bindings - ProgSocwhophd/stavros/416-slides.pdfController Model AVppKiewit Glue Code Foundation Core Data Cocoa Bindings Note: this slide has a build whose](https://reader033.vdocuments.us/reader033/viewer/2022050902/5adbba697f8b9aee348e702e/html5/thumbnails/52.jpg)
Key Value Coding (KVC)- (void)setName:(id)name;- (id)name;
![Page 53: Using and Customizing Cocoa Bindings - ProgSocwhophd/stavros/416-slides.pdfController Model AVppKiewit Glue Code Foundation Core Data Cocoa Bindings Note: this slide has a build whose](https://reader033.vdocuments.us/reader033/viewer/2022050902/5adbba697f8b9aee348e702e/html5/thumbnails/53.jpg)
Key Value Binding (KVB)- (void) bind:(NSString *)binding
toObject:(id)observable withKeyPath:(NSString *)keyPath options:(NSDictionary *)options
- (void) unbind:(NSString *)binding
![Page 54: Using and Customizing Cocoa Bindings - ProgSocwhophd/stavros/416-slides.pdfController Model AVppKiewit Glue Code Foundation Core Data Cocoa Bindings Note: this slide has a build whose](https://reader033.vdocuments.us/reader033/viewer/2022050902/5adbba697f8b9aee348e702e/html5/thumbnails/54.jpg)
Key Value Binding (KVB)- (void) bind:... {id observedController;id observedKeyPath;id bindingOptions;
}
![Page 55: Using and Customizing Cocoa Bindings - ProgSocwhophd/stavros/416-slides.pdfController Model AVppKiewit Glue Code Foundation Core Data Cocoa Bindings Note: this slide has a build whose](https://reader033.vdocuments.us/reader033/viewer/2022050902/5adbba697f8b9aee348e702e/html5/thumbnails/55.jpg)
Key Value Observing (KVO)- (void) addObserver:(id)observer forKeyPath:(NSString *)keyPath options:(NSKeyValueObservingOptions)options context:(void *)context
- (void) removeObserver:(id)observer forKeyPath:(NSString *)keyPath
![Page 56: Using and Customizing Cocoa Bindings - ProgSocwhophd/stavros/416-slides.pdfController Model AVppKiewit Glue Code Foundation Core Data Cocoa Bindings Note: this slide has a build whose](https://reader033.vdocuments.us/reader033/viewer/2022050902/5adbba697f8b9aee348e702e/html5/thumbnails/56.jpg)
Key Value Observing (KVO)- (void)observeValueForKeyPath:(NSString *)keyPath
ofObject:(id)object change:(NSDictionary *)change context:(void *)context;
![Page 57: Using and Customizing Cocoa Bindings - ProgSocwhophd/stavros/416-slides.pdfController Model AVppKiewit Glue Code Foundation Core Data Cocoa Bindings Note: this slide has a build whose](https://reader033.vdocuments.us/reader033/viewer/2022050902/5adbba697f8b9aee348e702e/html5/thumbnails/57.jpg)
Demo
![Page 58: Using and Customizing Cocoa Bindings - ProgSocwhophd/stavros/416-slides.pdfController Model AVppKiewit Glue Code Foundation Core Data Cocoa Bindings Note: this slide has a build whose](https://reader033.vdocuments.us/reader033/viewer/2022050902/5adbba697f8b9aee348e702e/html5/thumbnails/58.jpg)
Recap• Deep breath•MVC– Code reuse– Reusable controller layer for Cocoa– NSController subclasses– Binding objects
• New features– NSTreeController– Filtering– Core Data– Bindings and binding options
![Page 59: Using and Customizing Cocoa Bindings - ProgSocwhophd/stavros/416-slides.pdfController Model AVppKiewit Glue Code Foundation Core Data Cocoa Bindings Note: this slide has a build whose](https://reader033.vdocuments.us/reader033/viewer/2022050902/5adbba697f8b9aee348e702e/html5/thumbnails/59.jpg)
Recap• Deep breath• Tips and tricks– Bindings– Bindings options– Validation, coercion, transformation• Roll your own bindings– KVC, KVO, KVB– Model class support– View class support
![Page 60: Using and Customizing Cocoa Bindings - ProgSocwhophd/stavros/416-slides.pdfController Model AVppKiewit Glue Code Foundation Core Data Cocoa Bindings Note: this slide has a build whose](https://reader033.vdocuments.us/reader033/viewer/2022050902/5adbba697f8b9aee348e702e/html5/thumbnails/60.jpg)
Documentation & Sample Code
Sample Code & Demosconnect.apple.com: Download Software → WWDC 2004 Application Technologies 416
Cocoa BindingsADC Home > Reference Library > Cocoa
Cocoa Bindings ReferenceADC Home > Reference Library > Cocoa
Reference Library
![Page 62: Using and Customizing Cocoa Bindings - ProgSocwhophd/stavros/416-slides.pdfController Model AVppKiewit Glue Code Foundation Core Data Cocoa Bindings Note: this slide has a build whose](https://reader033.vdocuments.us/reader033/viewer/2022050902/5adbba697f8b9aee348e702e/html5/thumbnails/62.jpg)
Q&A
Malcolm CrawfordTechnical Writer
![Page 63: Using and Customizing Cocoa Bindings - ProgSocwhophd/stavros/416-slides.pdfController Model AVppKiewit Glue Code Foundation Core Data Cocoa Bindings Note: this slide has a build whose](https://reader033.vdocuments.us/reader033/viewer/2022050902/5adbba697f8b9aee348e702e/html5/thumbnails/63.jpg)