Welcome, Guest
Username Password: Remember me

How do I get UITableViewCellStyleSubtitle style?
(1 viewing) (1) Guest
  • Page:
  • 1
  • 2

TOPIC: How do I get UITableViewCellStyleSubtitle style?

How do I get UITableViewCellStyleSubtitle style? 1 year, 8 months ago #1

Hi,

I notice all the sample cells on your site show a label on the left and a value on the right. I'd like to use the UITableViewCellStyleSubtitle cell style so that the label is on top and the value is down below.

How would I achieve this?

Thanks,

Brendan
  • tapforms
  • OFFLINE
  • Expert Boarder
  • Posts: 120
  • Karma: 4
Thanks!
Brendan
www.tapforms.com

Re: How do I get UITableViewCellStyleSubtitle style? 1 year, 8 months ago #2

Hi Brendan,

All Sensible TableView cells are already of style type UITableViewCellStyleSubtitle. All you need to do is set SCTableViewCell.detailTextLabel.text property. Also, have a look at SCClassDefinition descriptionPropertyName property, which automatically sets the detail text from any of your bound object's properties.
  • tarekskr
  • OFFLINE
  • Administrator
  • Posts: 2402
  • Karma: 72

Re: How do I get UITableViewCellStyleSubtitle style? 1 year, 8 months ago #3

Thanks for your quick reply Tarek.

Using this code I get the label on the left and the value on the right:

SCLabelCell *labelCell = [SCLabelCell cellWithText:address.name withBoundObject:self.merchant.nearestLocation withLabelTextPropertyName:@"formattedAddress"];

I noticed your code was using the UITableViewCellStyleSubtitle. I'll look into your recommendations.

Thanks,

Brendan
  • tapforms
  • OFFLINE
  • Expert Boarder
  • Posts: 120
  • Karma: 4
Thanks!
Brendan
www.tapforms.com

Re: How do I get UITableViewCellStyleSubtitle style? 1 year, 2 months ago #4

Hi Tarek,

This worked great for labels, but what about auto-generated cells that have UITextFields or other controls in them? Is it possible to get the cell's label to appear above the control?

Like this:

First Name:
[ required ]

or

Gender:
[ Male | Female ]


Where [ required ] is a UITextField with a placeholder and [ Male | Female ] is a segmented control?

Thanks!

Brendan
  • tapforms
  • OFFLINE
  • Expert Boarder
  • Posts: 120
  • Karma: 4
Thanks!
Brendan
www.tapforms.com

Re: How do I get UITableViewCellStyleSubtitle style? 1 year, 2 months ago #5

Hi Brendan,

STV 2.0 has a delegate method called "tableViewModel:didLayoutSubviewsForCell:forRowAtIndexPath:", inside of which you can completely rearrange the cell controls.

 
- (void)tableViewModel:(SCTableViewModel *)tableViewModel
didLayoutSubviewsForCell:(SCTableViewCell *)cell
forRowAtIndexPath:(NSIndexPath *)indexPath
{
if([cell isKindOfClass:[SCTextFieldCell class]])
{
SCTextFieldCell *textFieldCell = (SCTextFieldCell *)cell;
textFieldCell.textLabel.frame = myLabelFrame;
textFieldCell.textField.frame = myFieldFrame;
}
}
 


We also have plans to provide different out-of-the-box rearrangements for text field cells in our next minor releases.

Hope this helps
  • tarekskr
  • OFFLINE
  • Administrator
  • Posts: 2402
  • Karma: 72

Re: How do I get UITableViewCellStyleSubtitle style? 1 year, 2 months ago #6

Fantastic!

Thanks Tarek!

Brendan
  • tapforms
  • OFFLINE
  • Expert Boarder
  • Posts: 120
  • Karma: 4
Thanks!
Brendan
www.tapforms.com
  • Page:
  • 1
  • 2
Time to create page: 1.74 seconds