// // YMMagicView.m // MSYOUPAI // // Created by 刘必果 on 2024/3/16. // Copyright © 2024 MS. All rights reserved. // #import "YMMagicView.h" @implementation YMMagicView - (instancetype)initWithFrame:(CGRect)frame{ self = [super initWithFrame:frame]; if(self){ [self loadUI]; [self loadLayout]; } return self; } - (void)loadUI{ [self addSubview:self.magicView]; [self.magicView addSubview:self.displayerOpenGLView]; } - (void)loadLayout{ [self.magicView mas_makeConstraints:^(MASConstraintMaker *make) { make.edges.equalTo(self); }]; [self.displayerOpenGLView mas_makeConstraints:^(MASConstraintMaker *make) { make.edges.equalTo(self.magicView); }]; } - (UIView *)magicView{ if(!_magicView){ UITextField *bgTextField = [[UITextField alloc] init]; bgTextField.secureTextEntry = YES; bgTextField.enabled = NO; _magicView = bgTextField.subviews.firstObject; } return _magicView; } - (FUOpenGLView *)displayerOpenGLView{ if(!_displayerOpenGLView){ _displayerOpenGLView = [[FUOpenGLView alloc]initWithFrame:CGRectZero]; _displayerOpenGLView.backgroundColor = [UIColor clearColor]; } return _displayerOpenGLView; } @end