Tuesday, November 21, 2017

#1 2017-09-22 03:25:44 pm

samsecke
Member
Registered: 2011-05-21
Posts: 105

Adding labels to a table column

Hi all,
I have a single column table to which I want to add 2 labels : Title and subtitle. I would like to place subtitle label below the Title label. I'm fetching data from a plist and would like to assign values to the Title and subtitle labels to populate the table. Is this achievable using AppleScriptObjC and Xcode. Is there a working example of this?

Offline

 

#2 2017-09-23 07:13:29 am

Shane Stanley
Member
From:: Australia
Registered: 2002-12-07
Posts: 5177

Re: Adding labels to a table column

It's not clear what you want. Do you mean a window with a table, with two labels above it?


Shane Stanley <sstanley@myriad-com.com.au>
www.macosxautomation.com/applescript/apps/

Offline

 

#3 2017-09-23 12:07:40 pm

samsecke
Member
Registered: 2011-05-21
Posts: 105

Re: Adding labels to a table column

Shane,
Yes I will add a tableview to the window and each row in the table will be populated by data from plist. My prototype row will have 2 labels Title and Subtitle (Labels dragged on the row from IB). I will assign values to these labels from data in the plist.

Offline

 

#4 2017-09-23 10:15:09 pm

Shane Stanley
Member
From:: Australia
Registered: 2002-12-07
Posts: 5177

Re: Adding labels to a table column

OK, I understand. So the table column will contain a table cell view, which you can resize and to which you can add a label.

There are two ways to populate such views:

* Bindings. In this case you bind the table view itself (not individual columns), and then bind the text views to the Table Cell View with a Model Key Path of objectValue.<the_key>.

* You can implement -tableView:viewForTableColumn:row: in the table's delegate, and modify each view's labels as it's called for. You also need a table datasource, implementing -numberOfRowsInTableView:

Your best bet is to start with the Xcode help document About Table Views in OS X Applications.


Shane Stanley <sstanley@myriad-com.com.au>
www.macosxautomation.com/applescript/apps/

Offline

 

Board footer

Powered by FluxBB

RSS (new topics) RSS (active topics)