Cannot update UI object's frame in UITableViewCell

后端 未结 6 1974
眼角桃花
眼角桃花 2021-01-19 02:18

I have a subclassed UITableViewCell.

I need to dynamically change the frame of a UILabel.

Here\'s what I\'ve done:

- (UITableViewCell *)table         


        
6条回答
  •  粉色の甜心
    2021-01-19 02:32

    There must be something wrong there.

    Try, just for testing to implement this:

    tableView:willDisplayCell:forRowAtIndexPath:
    

    Like

    - (void)tableView:(UITableView *)tableView willDisplayCell:(UITableViewCell *)cell    forRowAtIndexPath:(NSIndexPath *)indexPath
    {
        MessageCell* aCell = (MessageCell*)cell;
        aCell.Content.Text = @"Content!";
        [aCell.Content setFrame:CGRectMake(0, 0, 10, 10)];
    }
    

    What's the result?

提交回复
热议问题