Label background color #1816

Closed
wants to merge 1 commit into
from

Conversation

Projects
None yet
3 participants
Contributor

meeech commented Mar 23, 2012

Problem: You couldn't assign a backgroundColor directly to a label. It is initialized to clear.

This can lead to performance penalty, as described in this post: http://blogs.captechconsulting.com/blog/john-szumski/performance-tuning-older-ios-devices

Solution: Enabled setBackgroundColor_ for label. Performs as before - if no color given, defaults to clear (transparent) else assigns bg color to the label directly. If dev's care, they can take the time to set the proper label backgroundColor now.

Fix for Label Blending Issue:
Problem: You couldn't assign a backgroundColor directly to a label. It is initialized to clear. This can lead to performance penalty, as described in this post: http://blogs.captechconsulting.com/blog/john-szumski/performance-tuning-older-ios-devices
Solution: Enabled setBackgroundColor_ for label. Performs as before - if no color given, defaults to clear (transparent) else assigns bg color to the label directly.
Contributor

meeech commented Mar 23, 2012

Only gotcha I can think that would need to be accounted for here (beyond my ability) is when using backgroundImage, then would probably want to force the label color to clear again, since it seems bgimage stuff is being applied to a subview, not to the label itself.

But the substance of the fix still stands - would be good to have the ability to assign label color directly.

Contributor

marshall commented Mar 23, 2012

@meeech

Correct me if I'm wrong, but we already expose setBackgroundColor for all TiUIViews in TiUIView.m:
https://github.com/appcelerator/titanium_mobile/blob/master/iphone/Classes/TiUIView.m#L403

Contributor

meeech commented Mar 23, 2012

Hi marshall,
Yes. But this is specific to how labels are being handled in Ti.
Basically, its defaulted to clear. When you call setBackgroundColor on a label, its actually changing the underlying view containing the label. The BG color on the label remains clear. So it means labels always are being blended, and there's no way to stop it.

Contributor

meeech commented Mar 23, 2012

Here's an illustration. you can see all the labels in in my table are red - being blended. Even when the backgroundColor on each label is explicitly set to the same bg color as the table row.

Blend Screen Shot

Contributor

negupta commented Apr 20, 2012

@mitchell - We need a signed CLA in place before we can accept a PR. Did you sign one? I could not find it in our database.

Contributor

meeech commented Apr 20, 2012

nope. can send me the link?

Sent from my iPhone

On 2012-04-20, at 5:19 AM, Neeraj Guptareply@reply.github.com wrote:

@mitchell - We need a signed CLA in place before we can accept a PR. Did you sign one? I could not find it in our database.


Reply to this email directly or view it on GitHub:
#1816 (comment)

Contributor

meeech commented Apr 22, 2012

done.

Contributor

negupta commented Apr 23, 2012

Signed CLA is in place.

Contributor

negupta commented Apr 27, 2012

@meech - Please file a JIRA ticket with a test case and we will process this PR at a priority.

Contributor

negupta commented Jun 3, 2012

@meeech - Do you plan to file a JIRA ticket with a test case to process this PR?

Contributor

meeech commented Jun 3, 2012

@negupta By test case, do you just mean an app.js example?
At this point, i think best to just close this one for 1.8.2. I'll have a look at fixing it up for 2.x, and take things like backgroundImage into account.

@meeech meeech closed this Jun 3, 2012

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment