Welcome, Guest
Username Password: Remember me

Remove text shadow of custom cells on cell highlighting/selection
(1 viewing) (1) Guest

TOPIC: Remove text shadow of custom cells on cell highlighting/selection

Remove text shadow of custom cells on cell highlighting/selection 1 year, 7 months ago #1

Hey there,

I'm currently replacing my UITableViews with Sensible TableViews and struggling with an issue affecting custom cells:

In

- (void)tableViewModel:(SCTableViewModel *)tableViewModel willConfigureCell:(SCTableViewCell *)cell forRowAtIndexPath:(NSIndexPath *)indexPath {
}


I configure my cell — I adjust the height and add some UILabels. I give these UILabels a custom font color and a fancy text shadow.

When the user taps on a cell, it is highlighted blue (default behavior) but the color of the labels remain. They don't change.

How do I adjust the color of the labels and remove the text shadow when the cell is highlighted (= when the blue highlighting appears)?

There is UILabel's highlightedTextColor attribute which works fine, but I did not find a solution to remove that text shadow.

Any help is appreciated.

Thanks,
Patrick
  • Patrick
  • OFFLINE
  • Senior Boarder
  • Posts: 49
  • Karma: 3
Last Edit: 1 year, 7 months ago by Patrick.

Re: Remove text shadow of custom cells on cell highlighting/selection 1 year, 7 months ago #2

Hi Patrick,

Have you tried setting the label's "backgroundColor" property to [UIColor clearColor] ? As for the text shadow, it should not be there if the label's "shadowColor" property is nil. Hope this helps
  • tarekskr
  • OFFLINE
  • Administrator
  • Posts: 2404
  • Karma: 72

Re: Remove text shadow of custom cells on cell highlighting/selection 1 year, 7 months ago #3

Thanks, Tarek.

I'm sure if I'm getting that.

I would like to have a "highlighted state" for the cells. Something pretty basic, I think.
When the user taps the row, the text color of the labels should become white (they are black before).

Why exactly should I adjust the "backgroundColor" property? Wouldn't the textColor make more sense?

And for the shadow: In which delegate do I have to set the shadowColor property to nil? There are delegates when the cells are displayed and when the user has tapped on them (so that a new view controller or whatever can come up). But there doesn't seem to be something for in between — when the user is currently tapping on the cell, when he is highlighting the cell.


To be honest, for this case "normal" UITableViews (UITableViewCells) seem to be much easier. And a big, big plus for normal table view cells: I can use the interface builder and UITableViewCell subclasses to configure the exact behavior when the cell is highlighted.

Maybe that's possible with Sensible TableView, too — but I don't know how.
  • Patrick
  • OFFLINE
  • Senior Boarder
  • Posts: 49
  • Karma: 3

Re: Remove text shadow of custom cells on cell highlighting/selection 1 year, 7 months ago #4

You're welcome Patrick, but I think I miss understood your question I thought you were talking about the labels' background color, not text color.

To change the color of the actual text when the cell is highlighted, all you need to do is set the "highlightedTextColor" property of your UILabel. As for which delegate to use to customize your cells, please check out these two posts:
www.sensiblecocoa.com/forum/general-disc...e-table-cell.html#12
www.sensiblecocoa.com/forum/sensible-tab...-properties.html#185

Finally, regarding creating your custom cells in Interface Builder, we have a surprise for you guys: we've been working on a new STV design where you'll be able to do just that! It won't make it to our 1.6 release (due in a few days), however, I can be sharing with you a beta version of this within about two weeks from now. I'll keep you posted on this.
  • tarekskr
  • OFFLINE
  • Administrator
  • Posts: 2404
  • Karma: 72

Re: Remove text shadow of custom cells on cell highlighting/selection 1 year, 7 months ago #5

To change the color of the actual text when the cell is highlighted, all you need to do is set the "highlightedTextColor" property of your UILabel.

Yep, that's easy.
But it actually does not solve my main problem which is to remove the text shadow when the cell is highlighted.


Finally, regarding creating your custom cells in Interface Builder, we have a surprise for you guys: we've been working on a new STV design where you'll be able to do just that! It won't make it to our 1.6 release (due in a few days), however, I can be sharing with you a beta version of this within about two weeks from now. I'll keep you posted on this.

That sounds absolutely awesome. I hope to be able to join the beta.
  • Patrick
  • OFFLINE
  • Senior Boarder
  • Posts: 49
  • Karma: 3
Last Edit: 1 year, 7 months ago by Patrick.

Re: Remove text shadow of custom cells on cell highlighting/selection 1 year, 7 months ago #6

Regarding the text shadow issue:

After playing around with this a bit, we realized that you need two new delegate methods added to STV so that you could easily turn on/off the text shadows. We've added these two methods and will send you an update right away. Here is some code sample showing this in action:

 
- (void)tableViewModel:(SCTableViewModel *)tableViewModel
willSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
SCTableViewCell *cell = [tableViewModel cellAtIndexPath:indexPath];
 
cell.textLabel.shadowColor = nil;
}
 
- (void)tableViewModel:(SCTableViewModel *)tableViewModel
didDeselectRowAtIndexPath:(NSIndexPath *)indexPath
{
SCTableViewCell *cell = [tableViewModel cellAtIndexPath:indexPath];
 
cell.textLabel.shadowColor = myShadowColor;
}
 


Hope this helps.
  • tarekskr
  • OFFLINE
  • Administrator
  • Posts: 2404
  • Karma: 72
Time to create page: 1.00 seconds