Open miyiyake opened 5 years ago
在[self.view addSubview:toolbar];
这句后面加这几句代码就不会奔溃了
UIVisualEffectView * effectView;
if ([toolbar isKindOfClass:[UIVisualEffectView class]]) {
effectView = (UIVisualEffectView*)toolbar;
toolbar = effectView.contentView;
}
Do not add subviews directly to the visual effect view itself, instead add them to the -contentView.
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.