Upgrade to Pro — share decks privately, control downloads, hide ads and more …

AppKit for iOS Developers

Delisa Mason
September 19, 2013

AppKit for iOS Developers

Pitfalls and tips for working with AppKit for those familiar with building iOS apps

Delisa Mason

September 19, 2013
Tweet

More Decks by Delisa Mason

Other Decks in Programming

Transcript

  1. AppKit - gui framework for os x - perspective of

    ios developers branching out - familiar to uikit users - refinements and cruft of age - not all UI to NS
  2. Pitfalls - assumptions and common pitfalls to cover - frame

    in common classes to encounter - not necessarily about porting
  3. ? why? - less constraints on distribution and memory usage

    - more intensive computation - it is cool
  4. ˒  - something a user wants while in multiple

    apps? - persistent utility - maybe launches at start up
  5. ˒  ? TheApp - accomplishes particular task - front

    and center - may be single use; disappear with the window
  6. ? - an experience requiring the entire screen all the

    time - game - system-altering utilities
  7. @interface MyViewController : NSViewController @end @implementation MyViewController - (void) viewDidLoad

    { // initialize some stuff } @end - lay out some code - does nothing
  8. NSViewController • commitEditingWithDelegate:didCommitSelector:contextInfo: • commitEditing • discardEditing • initWithNibName:bundle: •

    loadView • nibBundle • nibName • representedObject • setRepresentedObject: • setTitle: • setView: • title • view - instance methods - no view loading stage selectors - willLoad, didAppear
  9. NSWindowController •manages a window, usually loaded from a nib •has

    window loading stage selectors •windowDidLoad •windowWillLoad
  10. NSNavigationController there’s no nsnavigationcontroller! - how often do you have

    desktop apps change context entirely? - is it a good experience?
  11.  TheApp - focus should remain task or document -

    taking away context is unexpected
  12.  TheApp Stuff NSMenu maybe no window at all -

    menus for comprehensive lists of actions
  13. NSWindow ≠ UIWindow SIDEBAR - nswindows have more sizes, shapes,

    types - not always full screen - not always focused - people close them, - app keeps running
  14. Displays Multiple Sizes, Resolutions, Pixel Densities - windows on many

    more types of displays - keep in mind when designing interactions - that said, favorite interaction
  15. Making a Selection •Segmented Controls •Sliders •Combo Buttons •Radio Groups

    •Table Views - several controls suited to users performing a selection - focus on table view
  16. Making a Selection •Segmented Controls •Sliders •Combo Buttons •Radio Groups

    •Table Views - ios use is common - handy and unnecessarily complex flow chart
  17. Use NSTableView? Complex sidebar Persistent lists Spreadsheets - customized sidebar,

    not better served by a source list, a la finder - or central focus on a dataset is purpose of the app
  18. NSTableView •Cell-based or view-based content modes •Columns nstableview is well-suited

    to these kinds of functions - cell-based, as in cell in a spreadsheet, plain text - view-based, as in it has subviews, and probably custom layout - different delegate methods by content mode - more than one column, concern for cell population - sometimes easily built by bindings
  19. Bindings •Connects data and presentation •Integrates into interface builder •Can

    reduce “glue code” •Alternately invoked via bind:toObject:withKeyPath:options: - reflects changes bidirectionally - content and most interface elements connect controller property or model
  20. Bindings key-value observing key-value coding - not magic - layer

    on top of kvo/kvc - good to remember for debugging horribly wrong connections - refer cocoa bindings programming reference
  21. 1. Read the OS X HIG its a bit lengthy

    - covers usage of interface elements in depth - definitely not the same as the iOS HIG
  22. 2. Get down with Core Graphics or you will never

    figure out how to change the background color of an nsview