开发者

How to change the tableviewcell 's backgroundimage?

开发者 https://www.devze.com 2023-01-22 17:17 出处:网络
when I selected row, change the开发者_Go百科 backgroundimages?#define kCellHeight 50//Replace \'50\' with Height of your UITableViewCell

when I selected row, change the开发者_Go百科 backgroundimages?


        #define kCellHeight 50  //Replace '50' with Height of your UITableViewCell
        #define kSelectedCellBackgroundImage @"nameOfYourImage" //replace value inside "" with name of your image

        UIImageView *selectedBackgroundView = [[UIImageView alloc] initWithFrame:CGRectMake(0, 0, 320, kCellHeight)];
        [selectedBackgroundView setImage:[UIImage imageNamed:kSelectedCellBackgroundImage]];
        [cell setSelectedBackgroundView:selectedBackgroundView];
        [selectedBackgroundView release];


Set the selectedBackgroundView of UITableViewCell to your custom view.

0

精彩评论

暂无评论...
验证码 换一张
取 消