修改登录页SVGA动图

This commit is contained in:
chenshuanglin
2023-03-20 20:49:47 +08:00
parent 5bfb43093c
commit 3358f0c68e
4 changed files with 60 additions and 16 deletions

View File

@@ -9,6 +9,7 @@
///
#import <Masonry/Masonry.h>
#import <ReactiveObjC/ReactiveObjC.h>
#import <SVGA.h>
///Tool
#import "UIImage+Utils.h"
#import "ThemeColor.h"
@@ -35,7 +36,7 @@
@property (nonatomic,strong) UIButton *nextButton;
///
@property (nonatomic,strong) UIButton *backButton;
@property (nonatomic,strong) UIImageView *logoImageView;
@property (nonatomic,strong) SVGAPlayer *logoImageView;
@end
@implementation LoginPasswordViewController
@@ -53,6 +54,7 @@
[self initSubViews];
[self initSubViewConstraints];
[self initEvents];
[self loginAnimation];
}
- (void)touchesBegan:(NSSet<UITouch *> *)touches withEvent:(UIEvent *)event {
@@ -120,6 +122,18 @@
}] takeUntil:self.rac_willDeallocSignal];
}
- (void)loginAnimation {
SVGAParser *parser = [[SVGAParser alloc] init];
@weakify(self);
[parser parseWithNamed:@"login_logo" inBundle:nil completionBlock:^(SVGAVideoEntity * _Nonnull videoItem) {
@strongify(self);
if (videoItem != nil) {
self.logoImageView.videoItem = videoItem;
[self.logoImageView startAnimation];
}
} failureBlock:nil];
}
- (void)disMissVC {
UIViewController *vc = self.presentingViewController;
while (vc.presentingViewController) {
@@ -245,11 +259,11 @@
return _backButton;
}
- (UIImageView *)logoImageView {
- (SVGAPlayer *)logoImageView {
if (!_logoImageView) {
_logoImageView = [[UIImageView alloc] init];
_logoImageView.userInteractionEnabled = YES;
_logoImageView.image = [UIImage imageNamed:@"login_top_bg"];
_logoImageView = [[SVGAPlayer alloc] init];
_logoImageView.loops = 1;
_logoImageView.clearsAfterStop = NO;
}
return _logoImageView;
}

View File

@@ -9,6 +9,7 @@
///
#import <Masonry/Masonry.h>
#import <ReactiveObjC/ReactiveObjC.h>
#import <SVGA.h>
///Tool
#import "UIImage+Utils.h"
#import "ThemeColor.h"
@@ -30,7 +31,7 @@
@property (nonatomic,copy) NSString *phone;
///
@property (nonatomic,strong) UIButton *backButton;
@property (nonatomic,strong) UIImageView *logoImageView;
@property (nonatomic,strong) SVGAPlayer *logoImageView;
@end
@implementation LoginPhoneViewController
@@ -44,6 +45,7 @@
[self initSubViews];
[self initSubViewConstraints];
[self initEevents];
[self loginAnimation];
}
#pragma mark - Private Method
@@ -95,6 +97,18 @@
}];
}
- (void)loginAnimation {
SVGAParser *parser = [[SVGAParser alloc] init];
@weakify(self);
[parser parseWithNamed:@"login_logo" inBundle:nil completionBlock:^(SVGAVideoEntity * _Nonnull videoItem) {
@strongify(self);
if (videoItem != nil) {
self.logoImageView.videoItem = videoItem;
[self.logoImageView startAnimation];
}
} failureBlock:nil];
}
#pragma mark - Event Response
- (void)nextButtonAction:(UIButton *)sender {
LoginVerifCodeViewController * codeVC = [[LoginVerifCodeViewController alloc] init];
@@ -164,11 +178,11 @@
return _backButton;
}
- (UIImageView *)logoImageView {
- (SVGAPlayer *)logoImageView {
if (!_logoImageView) {
_logoImageView = [[UIImageView alloc] init];
_logoImageView.userInteractionEnabled = YES;
_logoImageView.image = [UIImage imageNamed:@"login_top_bg"];
_logoImageView = [[SVGAPlayer alloc] init];
_logoImageView.loops = 1;
_logoImageView.clearsAfterStop = NO;
}
return _logoImageView;
}

View File

@@ -9,6 +9,7 @@
///
#import <Masonry/Masonry.h>
#import <ReactiveObjC/ReactiveObjC.h>
#import <SVGA.h>
///Tool
#import "ThemeColor.h"
#import "XPMacro.h"
@@ -22,7 +23,7 @@
@interface LoginVerifCodeViewController ()<LoginVerifCodeProtocol>
///
@property (nonatomic,strong) UIImageView *backImageView;
@property (nonatomic,strong) SVGAPlayer *backImageView;
///
@property (nonatomic,strong) UILabel *titleLabel;
///
@@ -120,6 +121,18 @@
}
- (void)loginAnimation {
SVGAParser *parser = [[SVGAParser alloc] init];
@weakify(self);
[parser parseWithNamed:@"login_logo" inBundle:nil completionBlock:^(SVGAVideoEntity * _Nonnull videoItem) {
@strongify(self);
if (videoItem != nil) {
self.backImageView.videoItem = videoItem;
[self.backImageView startAnimation];
}
} failureBlock:nil];
}
- (void)httpRequestPhoneSmsCode {
[self.presenter phoneSmsCode:self.phone type:GetSmsType_Regist];
}
@@ -227,12 +240,11 @@
}
}
#pragma mark - Getters And Setters
- (UIImageView *)backImageView {
- (SVGAPlayer *)backImageView {
if (!_backImageView) {
_backImageView = [[UIImageView alloc] init];
_backImageView.userInteractionEnabled = YES;
_backImageView.image = [UIImage imageNamed:@"login_top_bg"];
_backImageView.backgroundColor = [UIColor greenColor];
_backImageView = [[SVGAPlayer alloc] init];
_backImageView.loops = 1;
_backImageView.clearsAfterStop = NO;
}
return _backImageView;
}

View File

@@ -176,7 +176,9 @@ typedef NS_ENUM(NSUInteger, XYLoginType) {
- (void)loginAnimation {
SVGAParser *parser = [[SVGAParser alloc] init];
@weakify(self);
[parser parseWithNamed:@"login_logo" inBundle:nil completionBlock:^(SVGAVideoEntity * _Nonnull videoItem) {
@strongify(self);
if (videoItem != nil) {
self.logoImageView.videoItem = videoItem;
[self.logoImageView startAnimation];
@@ -567,6 +569,8 @@ typedef NS_ENUM(NSUInteger, XYLoginType) {
- (SVGAPlayer *)logoImageView {
if (!_logoImageView) {
_logoImageView = [[SVGAPlayer alloc] init];
_logoImageView.loops = 1;
_logoImageView.clearsAfterStop = NO;
}
return _logoImageView;
}