Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/ios/106.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ios 如果字符串长度大于标签中显示的行数,如何使add在UILable中看到更多功能?_Ios_Objective C_Iphone - Fatal编程技术网

Ios 如果字符串长度大于标签中显示的行数,如何使add在UILable中看到更多功能?

Ios 如果字符串长度大于标签中显示的行数,如何使add在UILable中看到更多功能?,ios,objective-c,iphone,Ios,Objective C,Iphone,我使用下面的代码计算所需的标签大小 CGSize expectedLabelSize = [text sizeWithFont:instructions.font constrainedToSize:instructions.frame.size lineBreakMode:UILineBreakModeWordWrap]; int numberofline = ceil

我使用下面的代码计算所需的标签大小

CGSize expectedLabelSize = [text sizeWithFont:instructions.font 
                            constrainedToSize:instructions.frame.size
                                lineBreakMode:UILineBreakModeWordWrap];
 int numberofline = ceil(lable.frame.size.height / font.lineHeight);
我用下面的代码计算标签的行数

CGSize expectedLabelSize = [text sizeWithFont:instructions.font 
                            constrainedToSize:instructions.frame.size
                                lineBreakMode:UILineBreakModeWordWrap];
 int numberofline = ceil(lable.frame.size.height / font.lineHeight);
在我的情况下,我只需要在按钮上单击3行即可在tableview中显示孔文本…由于修改了单元格高度

//请帮助我检查如何获取给定字体系列的字符数

!![这是演示图片][1] 请参见以下链接上的图片
[单击以查看图像演示][1]

设置
UILable
noOfLines=0的属性,该属性默认为1。这将自动增加你的行数

如果你的文本超过你定义的行数,则使用文本字段而不是标签,因此它将添加滚动。你可以设置用户交互禁用你的问题充满拼写错误、语法错误和非句子,很难说出你在问什么。我想您是在问如何调整UILabel的大小,使其足够高以显示给定的文本块。不过,有几件事没有道理。为什么要计算所需的像素数,然后再转换回若干行?您可以将标签的线条高度设置为0,它将根据需要显示任意多的线条。另一个问题是,您的帖子以我认为应该是指向图像的链接结尾,但格式不正确。你应该解决这个问题。