ibireme / YYText

Powerful text framework for iOS to display and edit rich text.
MIT License
8.86k stars 1.7k forks source link

Xcode10.1 iOS11.0.2 #851

Open miyiyake opened 5 years ago

miyiyake commented 5 years ago

yytext demo 中列表中两个闪退 Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: '<YYFPSLabel: 0x10c5503c0; baseClass = UILabel; frame = (5 10; 55 20); clipsToBounds = YES; userInteractionEnabled = NO; layer = <_UILabelLayer: 0x1c409b7b0>> has been added as a subview to <UIVisualEffectView: 0x10c54f610; frame = (0 64; 414 40); layer = <CALayer: 0x1c423efc0>>. Do not add subviews directly to the visual effect view itself, instead add them to the -contentView.'

Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: '<UILabel: 0x153d57010; frame = (10 0; 54.9102 40); text = 'Vertical:'; userInteractionEnabled = NO; layer = <_UILabelLayer: 0x1c409a6d0>> has been added as a subview to <UIVisualEffectView: 0x153d3ee70; frame = (0 64; 414 40); layer = <CALayer: 0x1c40379e0>>. Do not add subviews directly to the visual effect view itself, instead add them to the -contentView.

mrZombie2016 commented 5 years ago

[self.view addSubview:toolbar];这句后面加这几句代码就不会奔溃了


    UIVisualEffectView * effectView;
    if ([toolbar isKindOfClass:[UIVisualEffectView class]]) {
        effectView = (UIVisualEffectView*)toolbar;
        toolbar = effectView.contentView;
    }
YangSaner commented 5 years ago

Do not add subviews directly to the visual effect view itself, instead add them to the -contentView.