UITableViewCell imageView padding

后端 未结 4 655
-上瘾入骨i
-上瘾入骨i 2021-01-12 07:22

I would like to set up margins or paddings for UITableView cells imageView, how could I do that? With heightForRowAtIndexPath I can only set rows height. And it

4条回答
  •  余生分开走
    2021-01-12 07:28

    This works on iOS 7:

    - (void)layoutSubviews
    {
        [super layoutSubviews];
        CGRect imageViewFrame = self.imageView.frame;
        imageViewFrame.origin.x = 10;
        imageViewFrame.origin.y += 5;
        imageViewFrame.size.height -= 10;
        imageViewFrame.size.width -= 10;
        self.imageView.frame = imageViewFrame;
    }
    

提交回复
热议问题