xcode11加载xib的UITextView报错。
解决方案一:UITextView控件用代码重新手写。
解决方案二:新建UITextViewWorkaround一个继承NSObject的类。如下:
@interface UITextViewWorkaround : NSObject
+ (void)executeWorkaround;
@end
@implementation UITextViewWorkaround
+ (void)executeWorkaround {
if (@available(iOS 13.2, *)) {
}else {
const char *className = "_UITextLayoutView";
Class class1 = objc_getClass(className);
if (nil == class1) {
class1 = objc_allocateClassPair([UIView class], className, 0);
objc_registerClassPair(class1);
#if DEBUG
printf("added %s dynamically\n", className);
#endif
}
}
}
@end
网友评论