Re: six things I wasn't able to do with Cocoa
Re: six things I wasn't able to do with Cocoa
- Subject: Re: six things I wasn't able to do with Cocoa
- From: Alastair Houghton <email@hidden>
- Date: Mon, 31 May 2010 18:49:14 +0100
On 31 May 2010, at 11:36, Uli Kusterer wrote:
>> *5)** **I **can't create a simple list*
>>
>> I did it the only way I could -- with a table that has one column, etc. Man
>> that was painful for a simple list. Is there a better way?
>
> I have to admit I thought AppKit's way of handling lists was the simplest out there: You implement -numberOfItemsInTableView: and -tableView:objectValueForTableColumn:row: in whatever object is in charge of the current window/table/whatever (or create a little helper object for this exact purpose), set it as the data source, and you're hunky-dory. It can even on-the-fly-convert from whatever internal data store you have to NSString* for display, and you don't have to pre-allocate a bunch of items like with List Manager or Data Browser. Were you doing something different?
>
> Out of curiosity, what simpler approach to creating a list have you seen?
While I'd be interested to hear from Bill exactly what he was expecting, I *suspect* that he's referring to the style of list control you get on other platforms, where the control itself holds the data. Such a design is, of course, mistaken, since it leads to needless duplication of the actual data, tempts the programmer to store data in the user interface itself, and can in some cases artificially limit the amount of data that a control can use. It is, however, quite common in other UI frameworks and I can see why someone might feel that a programmatic API whereby you *give* the control some data was simpler than the Cocoa data source approach.
Kind regards,
Alastair.
--
http://alastairs-place.net
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden