Could not instantiate class named _UITextLayoutView

环境:xcode 11.2 

iPhone真机,若低于iOS13.2的系统,毕现;

产生原因:

xcode自身的BUG,该bug已被Apple 员工证实。链接如下:https://forums.developer.apple.com/thread/125287#391939

解决办法:

1、回退Xcode版本到11.1,

2、用代码创建textView

3、在用xib创建时,添加如下代码:

- (instancetype)initWithCoder:(NSCoder*)coder{

    if(@available(iOS13.2, *)) {

        return[superinitWithCoder:coder];

    }else{

        self = [super initWithFrame:CGRectZero textContainer:nil];

        self.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight;

        self.contentMode = UIViewContentModeScaleToFill;

        self.scrollEnabled=false;

        self.translatesAutoresizingMaskIntoConstraints = false;

        self.font=***;

        self.textColor=***;//自定义颜色

        self.backgroundColor=***;

        return self;

    }

}

最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。