change width of a uitableviewcell

后端 未结 2 1417
旧巷少年郎
旧巷少年郎 2021-01-15 03:35

I try to change the with of a cell in a tableview, I don\'t do a custom cell, I just subclass uitableviewcell.

This is the class

@implementation cus         


        
相关标签:
2条回答
  • 2021-01-15 04:28

    If you want to change the height of the cell the implement the delegate method tableView:heightForRowAtIndexPath:.

    If you want to change the width then you should only change it visually (set transparent background for all cell's subviews except the ones that shouldn't be) or, if all the cells should have the same width, you might change the entire table view's width, as @Jerry Jones has advised...

    0 讨论(0)
  • 2021-01-15 04:35

    Table views change the frame of cells when they are added to the table view. If you want to change the width of a cell, you should either change the width of the table, or change the width of the contentView in the cell.

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