设置UITableViewCell文本的宽度 [英] set width of UITableViewCell text

查看:75
本文介绍了设置UITableViewCell文本的宽度的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个带有uitableviewcells的uitableview,但是我的一些文本太长了,一直到单元格的边缘,当我选择该附件时,我的附件刻度视图就会出现.

I have a uitableview with uitableviewcells however some of my text is so long its going right to the edge of the cell, where my accessory tick view is going to be when selected..

我当前正在包装文本,如果它超出了宽度并且进入了第二行.但是我希望有一种很好的方法来限制此UITableViewCell标签的宽度.

I am currently wrapping the text if it extends beyond the width and it goes onto the second line.. However I was hoping there is a nice way to restrict the width of this UITableViewCell label.

推荐答案

cellForRowAtIndexPath中设置textLabel

cell.textLabel.frame = CGRectMake(cell.textLabel.frame.origin.x, cell.textLabel.frame.origin.y, 280, cell.textLabel.frame.size.height);

仅此而已.

这篇关于设置UITableViewCell文本的宽度的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆