iPhone + UITableView + place an image for separator

后端 未结 3 459
生来不讨喜
生来不讨喜 2020-12-15 14:33

I have UITableView in my application.

Attributes: TableStyle = Plain, SeperatorStyle = single and SeperatorColor = black

What I want to do is that, I want to

3条回答
  •  眼角桃花
    2020-12-15 15:18

    I want just to add some thoughts to Andrew Johnson's answer.

    If you add subview to contentView and use accesoryView or image,then it'll show separator image incorrectly. Use something like

    UIView *bg = [[UIView alloc] initWithFrame:CGRectMake(5, 5, 40, 40)];
        bg.backgroundColor = [[UIColor redColor] colorWithAlphaComponent:0.2];
                        //or [UIColor colorWithImagePattern];
                        //or crete UIImageView and assign to backgroundView of the cell
    self.backgroundView = bg;
    [bg release];
    

提交回复
热议问题