Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/google-cloud-platform/3.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
Xcode 减小uiTextView中的字体大小。_Xcode_Ios7_Uitextview_Contentsize - Fatal编程技术网

Xcode 减小uiTextView中的字体大小。

Xcode 减小uiTextView中的字体大小。,xcode,ios7,uitextview,contentsize,Xcode,Ios7,Uitextview,Contentsize,我在一个应用程序中有以下代码,可以减小字体大小以适应固定的uiTextView if (pdThree.contentSize.height > pdThree.frame.size.height) { int fontIncrement = 1; while (pdThree.contentSize.height > pdThree.frame.size.height) { pdThree.font = [UIFont systemFontOfSiz

我在一个应用程序中有以下代码,可以减小字体大小以适应固定的uiTextView

if (pdThree.contentSize.height > pdThree.frame.size.height) {
    int fontIncrement = 1;
    while (pdThree.contentSize.height > pdThree.frame.size.height) {
        pdThree.font = [UIFont systemFontOfSize:kDefaultFontSize-fontIncrement];
        fontIncrement++;
    }
}
但是我知道contentSize.height不再正常工作,有人能帮忙吗


非常感谢

我通过进一步挖掘堆栈溢出找到了答案。回答这里

多亏了

下面是我使用的代码:-

while (((CGSize) [pdThree sizeThatFits:pdThree.frame.size]).height > pdThree.frame.size.height) {
    pdThree.font = [pdThree.font fontWithSize:pdThree.font.pointSize-1];
}