设置文本属性后正在重置 UITextView 样式 [英] UITextView style is being reset after setting text property

查看:21
本文介绍了设置文本属性后正在重置 UITextView 样式的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有 UITextView *_masterText 并且在调用方法 setText 属性字体后被重置.它发生在我更改 sdk 7 之后._masterText 是 IBOutlet,全局和属性在 storyboard 中设置.只有我一个人还是这是一般的 SDK 错误?

I have UITextView *_masterText and after call method setText property font is being reset. It's happening after I change sdk 7. _masterText is IBOutlet, global and properties are set in storyboard. It's only me or this is general SDK bug?

@interface myViewController : UIViewController
{
  IBOutlet UITextView *_masterText;
}

@implementation myViewController

-(void)viewWillAppear:(BOOL)animated
{
    [_masterText setText:@"New text"];
}

推荐答案

坐了几个小时,我发现了错误.如果属性 "Selectable" = NO 它将在使用 setText 时重置字体和字体颜色.

Sitting with this for hours, I found the bug. If the property "Selectable" = NO it will reset the font and fontcolor when setText is used.

所以打开 Selectable,错误就消失了.

So turn Selectable ON and the bug is gone.

这篇关于设置文本属性后正在重置 UITextView 样式的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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