UITableViewCell根据内容自适应高度
2014-12-16 13:18
429 查看
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"cell"]; if (cell == nil) { cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:@"cell"]; } cell.textLabel.text = @"cell自适应高度"; cell.textLabel.frame = CGRectMake(0, 0, 100, 100); // 设置textLable 高度 return cell; } - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section { return 5; } - (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath { UITableViewCell *cell = [self tableView:tableView cellForRowAtIndexPath:indexPath]; return cell.textLabel.frame.size.height; // 返回textLabel的高度,在这里可以根据你cell上的内容设置cell的高度 }
相关文章推荐
- 父容器不根据内容自适应高度的解决方法
- UIWebView根据内容自适应高度
- 根据文本内容快速自适应控件的宽度和高度
- Jquery实现textarea根据文本内容自适应高度
- Android 让GridView的高度为Wrap_content根据内容自适应高度
- ios之label根据内容自适应及其计算其内容高度
- Textarea 高度自适应 根据内容自适应高度
- [转]autoTextarea-文本框根据输入内容自适应高度
- textarea 根据内容自适应高度
- 基于JQ 根据输入内容自适应输入框高度 支持输入增高 渲染时设置高度和内容一致
- labe 高度根据内容的自适应
- Div即父容器不根据内容自适应高度的解决方法
- jquery/js实现文本框根据输入内容input,textarea自适应高度
- UILable根据文字内容,自适应高度
- 关于textView根据输入内容自适应高度
- 使用SDAutoLayout实现控件根据内容进行宽度自适应和高度自适应
- iOS开发-UITextView根据内容自适应高度
- 文本框根据输入内容自适应高度的代码
- 如何设置UITableViewCell中cell内容的自适应高度
- UITableViewCell根据内容自动高度