struggling with formatting dynamic row height in UITableView

后端 未结 3 1224
清歌不尽
清歌不尽 2021-02-06 18:30

I am trying to resize the height of my row in UITableView based on the text length. I have the following code:

- (CGFloat)tableView:(UITableView *)tableView heig         


        
3条回答
  •  有刺的猬
    2021-02-06 19:26

    The work of changing cell's subviews' frames is done in - (void)layoutSubviews of UITableViewCell class, so if you want alter that behavior you can subclass common UITableViewCell and then do smth like:

    @implementation MyTableViewCell
    
    - (void)layoutSubviews {
        [super layoutSubviews];
        self.imageView.frame = CGRectMake( -- your own size -- );
    }
    
    @end
    

提交回复
热议问题