开发者

Dividing a table cell into two parts

开发者 https://www.devze.com 2023-03-01 17:24 出处:网络
How can I divide a table cell into two p开发者_如何学Pythonarts?A table cell is bydefault divided in three sections, the image on the left, the text labels in the center and the accessory view on the

How can I divide a table cell into two p开发者_如何学Pythonarts?


A table cell is bydefault divided in three sections, the image on the left, the text labels in the center and the accessory view on the right. If u want more divisions or customize them, you have to customize the table cell by inheriting the UITableViewCell.


You can add simply 2 SubViews in to the cell and nest whatever you want inside.


As told by shani, Create two subview with its frame and add them on the cell. Here I will show sample structure,

UITableViewCell *cell  = [[UITableViewCell alloc]initWithStyle:UITableViewCellStyleSubtitle reuseIdentifier:@"cell"];
UILabel *label1=//create a label1 with frame
UILabel *label2=//create a label2 with frame
[cell.contentView  addSubview:label1];
[cell.contentView  addSubview:label2];
0

精彩评论

暂无评论...
验证码 换一张
取 消