简体   繁体   English

iOS UILabel显示白线

[英]IOS UILabel showing white line

I have the following implementation of a UILabel. 我有以下UILabel的实现。 I can confirm that there ins a NSString being passed in, but all I seem to be getting out is a white line 我可以确认有一个NSString传入,但是我似乎要走的只是一条白线

any ideas? 有任何想法吗?

        CGRect labelFrame = CGRectMake(10, 5, 300, 20);                
        UILabel *label = [[UILabel alloc] initWithFrame:labelFrame];
        label.font = [UIFont systemFontOfSize:15];
        label.text = labelText; 
        [textView addSubview:label];

Try adding [label setAdjustsFontSizeToFitWidth:YES] (you must also set the minimum font size to something small). 尝试添加[label setAdjustsFontSizeToFitWidth:YES](您还必须将最小字体大小设置为较小的值)。 Also, make sure the textColor value is not transparent and maybe give it some more height. 另外,请确保textColor值不是透明的,并可能为其提供更多的高度。 Don't forget to release the label if there isn't ARC enabled. 如果没有启用ARC,请不要忘记释放标签。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM