| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889 |
- //
- // MOSignInNewView.m
- // MiMoLive
- //
- // Created by SuperC on 2024/4/29.
- //
- #import "MOSignInNewView.h"
- @interface MOSignInNewView ()
- @property (nonatomic, strong) UIButton *tagBtn;
- /** svga 播放 管理类 */
- @property (nonatomic, strong) MOSVGACustomPlayer *aPlayer;
- @property (nonatomic, strong) SVGAParser *aParser;
- @end
- @implementation MOSignInNewView
- + (instancetype)moSignInNewView{
- return [[[NSBundle mainBundle] loadNibNamed:@"MOSignInNewView" owner:self options:nil] firstObject];
- }
- - (void)awakeFromNib{
- [super awakeFromNib];
- [self addSubview:self.aPlayer];
- [self.aPlayer mas_makeConstraints:^(MASConstraintMaker *make) {
- make.edges.equalTo(self);
- }];
-
- self.aPlayer.loops = 0;
- self.aPlayer.clearsAfterStop = NO;
-
- WEAKSELF
- //icon_live_sign_in
- [self.aParser parseWithNamed:@"icon_live_sign_in" inBundle:nil completionBlock:^(SVGAVideoEntity * _Nonnull videoItem) {
- if (videoItem) {
-
- weakSelf.aPlayer.videoItem = videoItem;
- [weakSelf.aPlayer startAnimation];
- }
- } failureBlock:^(NSError * _Nonnull error) {
- MOLogV(@"播放失败~~~~~~~~");
- }];
-
- [self addSubview:self.tagBtn];
- [self.tagBtn mas_makeConstraints:^(MASConstraintMaker *make) {
- make.edges.equalTo(self);
- }];
- }
- #pragma mark - Lazy
- - (UIButton *)tagBtn{
- if (!_tagBtn)
- {
- _tagBtn = [UIButton buttonWithType:UIButtonTypeCustom];
- _tagBtn.backgroundColor = [UIColor clearColor];
- [_tagBtn addTarget:self action:@selector(tagBtnClick) forControlEvents:UIControlEventTouchUpInside];
- }
- return _tagBtn;
- }
- - (void)tagBtnClick{
- self.tagClickBlock ? self.tagClickBlock() : nil;
- }
- - (MOSVGACustomPlayer *)aPlayer{
- if (_aPlayer == nil) {
- _aPlayer = [[MOSVGACustomPlayer alloc] init];
- _aPlayer.contentMode = UIViewContentModeScaleAspectFit;
- _aPlayer.loops = 0;
- _aPlayer.clearsAfterStop = NO;
- }
- return _aPlayer;
- }
- - (SVGAParser *)aParser{
-
- if (_aParser == nil) {
- _aParser = [[SVGAParser alloc] init];
- }
-
- return _aParser;
- }
- @end
|