Advertise here




Advertise here

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

UITableViewCell ==> Background image ??!!

aryaxtaryaxt Posts: 570Registered Users
edited May 2010 in iOS SDK Development
I've been trying to set a back ground image to each cell of my uitableview, but didn't get anywhere.
Anybody has a solution?

Thanks in advance
Post edited by aryaxt on
·

Replies

  • aryaxtaryaxt Posts: 570Registered Users
    edited July 2009
    Problem solved.
    Create an UIImageView, set the frame equal to the cell frame and add it to the "cell.contentView", then send it to back so it doesn't go on top of your text.
    ·
  • turbotomatoturbotomato Posts: 10Registered Users
    edited July 2009
    UITableViewCell has properties for both backgroundView and selectedBackgroundView. You shouldn't have to add your image view as a subview of the contentView.
    ·
  • aryaxtaryaxt Posts: 570Registered Users
    edited July 2009
    I actuaqlly tried to use the backgroundview, and i couldn't get it to work.
    I tried to add the uiimageview to the backgroundview instead, and never showed up.
    ·
  • BrianSlickBrianSlick Treadmill Desk Ninja Posts: 10,667Tutorial Authors, Registered Users @ @ @ @ @ @ @ @
    edited July 2009
    aryaxt wrote: »
    I actuaqlly tried to use the backgroundview, and i couldn't get it to work.
    I tried to add the uiimageview to the backgroundview instead, and never showed up.

    I'm pretty sure that you don't add it TO the backgroundview, you set it AS the background view. Ex:

    [cell setBackgroundView: yourView];

    But I haven't messed with it much, so could be wrong. Either way, posting your code will go a long way towards solving your problem.
    Professional iOS App Development. Available for hire.
    BriTer Ideas LLC - WWW | Facebook | Twitter | LinkedIn

    BTIKit | BTICoreDataKit | SlickShopper 2 | Leave a PayPal donation
    ·
  • aryaxtaryaxt Posts: 570Registered Users
    edited July 2009
    Thanks, I'll try that
    ·
  • sophistisophisti Posts: 5New Users
    edited January 2010
    BrianSlick wrote: »
    I'm pretty sure that you don't add it TO the backgroundview, you set it AS the background view. Ex:

    [cell setBackgroundView: yourView];

    But I haven't messed with it much, so could be wrong. Either way, posting your code will go a long way towards solving your problem.

    This works indeed!
    ·
  • beleg_1998beleg_1998 Posts: 41Registered Users
    edited May 2010
    sophisti wrote: »
    This works indeed!

    ever run into the problem where the backgroundView from one cell is overlapping the content of another cell in another section?
    ·
  • BrianSlickBrianSlick Treadmill Desk Ninja Posts: 10,667Tutorial Authors, Registered Users @ @ @ @ @ @ @ @
    edited May 2010
    Might just need to set the clipsToBounds property.
    Professional iOS App Development. Available for hire.
    BriTer Ideas LLC - WWW | Facebook | Twitter | LinkedIn

    BTIKit | BTICoreDataKit | SlickShopper 2 | Leave a PayPal donation
    ·
Sign In or Register to comment.