关于(UITableViewcell)contentView高度的问题
来源:互联网 发布:淘宝发货没有无需物流 编辑:程序博客网 时间:2024/05/16 04:16
cell.contentView.frame.size.height//高度默认为44.0
如果想改变这个数值,让它返回我们设置的row的高度
在重写cell的时候,要在layoutSubviews中设置子控件的frame,如果在init中设置控件frame则无效,还是返回默认高度。
#import "PTRuleTableViewCell.h"@interface PTRuleTableViewCell ()@property (strong, nonatomic) UIView *bottomLine;@property (strong, nonatomic) UILabel *label1;@property (strong, nonatomic) UIView *line1;@end@implementation PTRuleTableViewCell- (void)awakeFromNib { [super awakeFromNib]; // Initialization code}- (void)setSelected:(BOOL)selected animated:(BOOL)animated { [super setSelected:selected animated:animated]; // Configure the view for the selected state}- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{ self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]; if (self) { _bottomLine = [[UIView alloc] init]; _bottomLine.backgroundColor = RGBCOLOR(60, 170, 250); [self addSubview:_bottomLine]; _line1 = [[UIView alloc] init]; _line1.backgroundColor = RGBCOLOR(60, 170, 250); [self addSubview:_line1]; _label1 = [[UILabel alloc] init]; _label1.backgroundColor = [UIColor clearColor]; [self addSubview:_label1]; } return self;}-(void)layoutSubviews{ [super layoutSubviews]; _bottomLine.frame = CGRectMake(15*UIRate, self.contentView.frame.size.height - 0.5, SCREEN_WIDTH - 30*UIRate, 0.5); _line1.frame = CGRectMake(15*UIRate, 0, 0.5, self.contentView.frame.size.height); _label1.frame = CGRectMake(15*UIRate, 0, 90*UIRate, self.contentView.frame.size.height);}
1 0
- 关于(UITableViewcell)contentView高度的问题
- UITableViewCell的contentView
- 关于UITableViewCell (xib) 自适应高度的问题
- 设置UITableViewCell高度的问题
- Cell简介和UITableViewCell的contentView
- 关于UItableViewCell上加载UIWebView自适应高度问题
- UITableViewCell的contentView中的UITextField的值获取的方法
- iOS UI 的坑:不要 remove UITableViewCell 的 contentView
- iOS UI 的坑:不要 remove UITableViewCell 的 contentView
- UITableViewCell使用cell和cell.contentView的区别
- UITableViewCell中的使用cell和cell.contentView的区别
- UITableViewCell的动态高度
- UITableViewCell的动态高度
- UITableViewCell 高度的自适应
- UITableViewCell的高度自适应
- 关于UITableViewCell的自适应高度使用后的心得记录
- 关于UITableViewCell 自适应内容高度时的注意点
- UITableViewCell 自动计算高度遇到的一些诡异问题
- 全息投影技术
- HtmlUnit解析动态网页并采集网页列表到Excel
- win7 64位下安装ubtuntu双系统,默认windows7系统
- SoftReference
- Jenkins + SVN + Batch Command (项目的自动打包和部署)
- 关于(UITableViewcell)contentView高度的问题
- HttpURLConnection请求
- 发布IOS产品被拒后如何再上传新发布包
- Xshell -- 中文乱码问题
- ios开发网络篇—NSURLConnection基本使用
- 侧滑
- Javascript this关键字
- 给分类设置Meta Keywords
- 转载:对大学 IT 专业教育的反馈