Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-539] Text anti-aliasing on tableView labels after scrolling back on to the screen

GitHub Issuen/a
TypeBug
PriorityMedium
StatusClosed
ResolutionFixed
Resolution Date2011-04-17T01:53:26.000+0000
Affected Version/sn/a
Fix Version/sRelease 1.3.0
ComponentsiOS
Labelsdefect, ios, iphone, label, tableview, text
Reporterkosso
AssigneeBlain Hamon
Created2011-04-15T02:31:24.000+0000
Updated2011-04-17T01:53:26.000+0000

Description

Hi,

I've seen this happen a few times. When I load at the vertical layout demo in KS (on indeed my own app which uses this layout) the text labels are nice and crisp.

If I then scroll the rows up out of view - and then back in to view, the text is slightly blurred. (Called anti-aliasing)

I have a feeling this is happening when the row is repainted as it comes back in to view and the calculations for the rowheight might be float values, instead of integers (as we use when we set positions for our labels - in whole numbers)

The reason I think it's this, is that this used to happen a lot with Flash development - especially with certain types of text. We had to make sure the positioning of the text was exactly 'on the pixel'.

Probably this could be easily fixed (by Blain?) in TiUITableViewRowProxy.m ?? :)

Attachments

FileDateSize
blurring.jpg2011-04-15T02:31:24.000+0000213277
tableview_blurringjs.zip2011-04-15T02:31:24.000+00003887

Comments

  1. James K 2011-04-15

    I am encountering this problem regularly.

    It only happens for labels added to table view rows - not for native title text.

    Whether it happens for a particular label appears to be influenced by the extent to which the label text is constrained by top, bottom, left, right, width and height.

    Setting both left and right in conjunction with width:auto seems to create the problem, but sometimes it's okay if you only set two of those three properties (which then precludes some complex layouts).

  2. kosso 2011-04-15

    thanks for this info.

    I tried just using 2 settings - an absolute left and an auto height (with textAlign:left) and I still the blurring when the row comes back in to view after scrolling off.

    I'm also placing my labels etc. in the row within a vertical layout view.

  3. Stephen Tramer 2011-04-15

    Should be fixed by #722. Please test.

  4. kosso 2011-04-15

    Hi,

    I'm still seeing it happen after building the latest 1.2.0 today.

    Oddly, I'm sometimes seeing it blurred before scrolling offscreen, then sharpening up after scrolling off and on again.

    I've also tried setting my labels to even number positions and widths.

    Also bear in mind (if it's worth mentioning) that I use these labels (of varying fontSize and fontWeight, though I have tried setting fontSize to even numbers too) in a tableView WITHIN a 'vertical' layout view (with 'auto' height) - and usually with textAlign left - WITHIN each tableViewRow

    See the attached image, where the top three rows have been scrolled out and then in to view.

    The titles have got blurred, yet the 'time ago' labels have got sharper.

  5. Stephen Tramer 2011-04-15

    There is a chance that this is also related to #709. TableRowViews are handled differently than other views because they are dynamically loaded. Keep this a separate issue from #722.

  6. Stephen Tramer 2011-04-15

    Please provide me with some sample code so that I can replicate the problem.

  7. kosso 2011-04-15

    Hi Stephen.

    Here you go. See attached zip. (I have removed some of the functionality of this page in my app - which loads some JSON from my server and displays a tableView. You should be able to load it fine though)

    Scroll the rows up and down and you should see the effects on the various labels used.

    thx
    Kosso

  8. Jeff Haynie 2011-04-15

    (from [e4650d92e0a3192a758e8fae9ea38001f6bc529c]) Closes #539. Bounds/Frames for UILabels always need to be on integer boundaries in the largest possible frame of reference. http://github.com/appcelerator/titanium_mobile/commit/e4650d92e0a3192a758e8fae9ea38001f6bc529c"> http://github.com/appcelerator/titanium_mobile/commit/e4650d92e0a31...

  9. kosso 2011-04-15

    I'm still seeing this occur in places where left, right, height, top or bottom are odd numbers (with textAlign right or left) - in places like vertical layout scrollViews, tableViews, activityIndicator messages and others.

    Making sure things are on even numbers seems to help.

    It's got much better though. ;)

JSON Source