UITableViews setText

Discussion in 'iOS Development' started by Chicken, May 16, 2009.

  1. Chicken

    Chicken Retired Moderator

    Joined:
    Feb 17, 2008
    Messages:
    2,494
    Likes Received:
    7
    Device:
    iPhone 5S
    I'm not sure if this is under NDA if I'm meant to be talking about it or not. So I payed the £59 ($99) for my developers license. I'm compiling for 3.0 and I get

    setText: is deprecated

    This is the line of code I am using

    Code:
    	cell.text = (([itemsArray objectAtIndex:indexPath.row]==nil) ? @"INVALID ARRAY OBJECT" : [itemsArray objectAtIndex:indexPath.row]);
    
    So what should I use instead?

    If this is under NDA please delete this thread. Thanks!
  2. SkylarEC

    SkylarEC Super Moderator Emeritus Staff Member

    Joined:
    Sep 19, 2007
    Messages:
    6,642
    Likes Received:
    129
    REad the docs that come with the SDK. You'll even know *why* it's deprecated.

    Basically, Apple wanted to make their table cells draw slower : (
  3. Chicken

    Chicken Retired Moderator

    Joined:
    Feb 17, 2008
    Messages:
    2,494
    Likes Received:
    7
    Device:
    iPhone 5S
    OK so it say's to use [redacted] instead but [redacted] is read only....

    Also when you say "the docs" you mean when you download the SDK or the documentation inside of Xcode.
  4. Cyanidepoison

    Cyanidepoison Active Member

    Joined:
    Jan 18, 2008
    Messages:
    1,076
    Likes Received:
    2
    Watch the videos that you have access to through being a part of the developer program on iTunes. It contains all the info that you need to do what you want.
  5. Chicken

    Chicken Retired Moderator

    Joined:
    Feb 17, 2008
    Messages:
    2,494
    Likes Received:
    7
    Device:
    iPhone 5S
    Ok thanks! I never thought of that. Also thanks to who ever redacted my comments.

    Please Register or Log in to view images

  6. gojohnnyboi

    gojohnnyboi Well-Known Member

    Joined:
    Jan 25, 2008
    Messages:
    3,339
    Likes Received:
    55
    One tip that I will pass to you is that you should subclass your UITableViewCells and do all the text and image drawing yourself. It makes for much faster scrolling.
  7. Steaps

    Steaps New Member

    Joined:
    Oct 24, 2007
    Messages:
    5,074
    Likes Received:
    41
    Device:
    iPod touch
    That's what Loren Brichter does with Tweetie, which explains how his application scrolls so insanely fast. Although i don't need it now, i wish i knew how to subclass a UITableViewCell to do the drawing myself. </noob>
  8. SkylarEC

    SkylarEC Super Moderator Emeritus Staff Member

    Joined:
    Sep 19, 2007
    Messages:
    6,642
    Likes Received:
    129
    Subclass the table cell how you would subclass anything else and override the drawRect: method (exactly as you would any other view). It is no different.

    A lot of these cats don't touch the layoutSubviews method, but I rely on it (for animation purposes of the cell). If you have no way to edit the cell, then go ahead and draw everything out in CG while drawing no alpha, without worrying about anything.

    TableCells are super easy.

Share This Page