How to change the size of the labels on a UITableViewCellStyleValue2 cell? (UITableView iPhone)

前端 未结 1 923
离开以前
离开以前 2020-12-31 11:39

I\'m using a UITableViewCellStyleValue2 cell in my UITableView in my app and I want the left column (the blue text - self.textField) to be much narrower than the default. I

1条回答
  •  长情又很酷
    2020-12-31 12:29

    You can subclass UITableViewCelland still use UITableViewCellStyleValue2. You can then overwrite the layoutSubviews method to change the size of the labels:

    - (void) layoutSubviews {
       [super layoutSubviews]; // layouts the cell as UITableViewCellStyleValue2 would normally look like
    
       // change frame of one or more labels
       self.textLabel.frame = CGRectMake(...);
       self.detailTextLabel.frame = CGRectMake(...);    
    }
    

    0 讨论(0)
提交回复
热议问题