Tuesday, 22 May 2012

Help with strategy for handling edits in view-based NSOutlineView


i'm building source-list itunes style app. have big xib handles primary window , owned app delegate. sourcelist (a view-based nsoutlineview) controlled nsviewcontroller subclass delegate , datasource. when setting nstablecellviews in sourcelist controller class's delegate method, i'm forced use nib's owner app delegate:

code:
 -(nsview *) outlineview: (nsoutlineview *)theoutlineview viewfortablecolumn: (nstablecolumn *)thetablecolumn item: (disourcelistnode *)theitem { ... nstablecellview *rtablecellview = [theoutlineview makeviewwithidentifier: @"maincell"  owner: [self appdelegate]]; ... } 
the docs i'm supposed use target action receive edit info user, doing requires action wired nib's owner app delegate, not preferred class of sourcelist controller. i'm trying figure out how structure controller classes , nibs encapsulated, , driving me nuts.

of apple's sample code features "god objects" controller sourcelist controller of stuff in nib such buttons , windows etc. avoids file's owner problem creates code controllers aren't defined. don't want app delegate delegate , data source of source list, because it's managing lot of stuff (the toolbar @ top, split view, loading appropriate contentviews etc).

solution comes mind breaking source list it's own nib file's owner being source list controller object. guess reasonable, seems foreign of examples i've ever run across. i'm hesitant stray far examples i've seen , worry there might negative unintended consequences going route. speaking, common patterns supposed easy cocoa, why suspect i'm overlooking more elegant solution. suggestions?
 

i put sourcelist in it's own nib sourcelistcontroller nib's owner, , editing working expected. i'm still ironing out other quirks (mainly drag/drop). helpful running issue. if approach leads issues down road i'll sure post them here.
 


Forums Macs Mac Programming


  • iPhone
  • Mac OS & System Software
  • iPad
  • Apple Watch
  • Notebooks
  • iTunes
  • Apple ID
  • iCloud
  • Desktop Computers
  • Apple Music
  • Professional Applications
  • iPod
  • iWork
  • Apple TV
  • iLife
  • Wireless

No comments:

Post a Comment