Possible UITableViewCell UILabel Compositing Anomaly

Consider a UITableViewCell with the UITableViewCellStyleDefault style , set to tableView:cellForRowAtIndexPath:and the gradient background located at tableView:willDisplayCell:forRowAtIndexPath:.

When this is rendered, it textLabelwill blend very well with the gradient, and the backlight also works.

Now, if we keep everything the same, but change the cell style to UITableViewCellStyleSubtitle ? In my case, textLabelthey detailTextLabelno longer mix! They take ... a different color. Not too far from the colors in the gradient, but it just doesn't mix. Change the style to the default and everything will be fine.

Now I understand that I can set the labels clearColorin ...willDisplayCell..., but they told me again and again: "Do not do this! Leave them alone."

Perhaps I need to do this as a workaround? Or maybe something else is wrong? Keys are welcome / appreciated!

+3
source share
1 answer

A workaround is to use the NSString drawInRect function. You can use the NSString method sizeWithFont: forWidth: lineBreakMode: to calculate the size of the rectangle, and then output the lines this way.

more about row sizes and draw here on the apple docs website .

0
source

All Articles