YYLabel在特殊字符串下会崩溃
问题:YYLabel在特殊字符串下会崩溃 导致崩溃的文本:ޙޓゝ₯ 测试机型:iPhone 6 plus 10.3.2 Xcode版本:8.3.3 YYText版本:1.0.7,1.0.5 测试代码:新建一个工程,使用cocoapods集成最新的YYText(1.0.7)
YYLabel *label = [YYLabel new];
label.textColor = [UIColor blackColor];
label.text = @"ޙޓゝ₯";
[self.view addSubview:label];
[label sizeToFit];
label.center = CGPointMake(self.view.frame.size.width * 0.5, self.view.frame.size.height * 0.5);
崩溃原因:_displayAsync 函数中UIGraphicsBeginImageContextWithOptions(size, opaque, scale);中的size过大,为YYTextContainerMaxSize定义的0x100000,导致内存分配益处,被iOS系统杀死。Xcode报错信息为:Message from debugger: Terminated due to memory issue。
6s plus也会崩溃
这里是因为没有设置rtl语言NSParagraphStyleAttributeName,设置成NSTextAlignmentLeft后就正常了,但是还是不知道具体什么原因导致foom
这里是因为没有设置rtl语言NSParagraphStyleAttributeName,设置成NSTextAlignmentLeft后就正常了,但是还是不知道具体什么原因导致foom
NSMutableAttributedString * attributing =[[NSMutableAttributedString alloc] initWithString:@"𝐊𝐇 ⁵ ¹ ¹ F²"]; nameString.yy_color = [UIColor whiteColor];// nameString.yy_font = [UIFont systemFontOfSize:15]; nameString.yy_alignment = NSTextAlignmentCenter; 有可能崩溃在nameString.yy_color = [UIColor whiteColor]这里,按照你说的,需要先设置 nameString.yy_alignment = NSTextAlignmentCenter;吗?