首页直播中动效
This commit is contained in:
@@ -8,6 +8,8 @@
|
||||
#import "XPFindNewFriendTableViewCell.h"
|
||||
/// Third
|
||||
#import <Masonry.h>
|
||||
#import <SVGAParser.h>
|
||||
#import <SVGAPlayer.h>
|
||||
/// Tool
|
||||
#import "NetImageView.h"
|
||||
#import "ThemeColor.h"
|
||||
@@ -33,7 +35,12 @@
|
||||
/// 签名
|
||||
@property (nonatomic, strong) UILabel *signLabel;
|
||||
/// 直播中/和Ta聊
|
||||
@property (nonatomic, strong) XPButton *livingBtn;
|
||||
@property (nonatomic, strong) SVGAPlayer *livingView;
|
||||
@property (nonatomic, strong) UIImageView *chatImageView;
|
||||
|
||||
@property (nonatomic, strong) UILabel *statusLabel;
|
||||
|
||||
@property (nonatomic, strong) UIStackView *statusStackView;
|
||||
|
||||
@end
|
||||
|
||||
@@ -59,6 +66,14 @@
|
||||
|
||||
[self initSubViews];
|
||||
[self initSubViewConstraints];
|
||||
|
||||
SVGAParser *parser = [[SVGAParser alloc] init];
|
||||
[parser parseWithNamed:@"home_living" inBundle:nil completionBlock:^(SVGAVideoEntity * _Nonnull videoItem) {
|
||||
if (videoItem != nil) {
|
||||
self.livingView.videoItem = videoItem;
|
||||
[self.livingView startAnimation];
|
||||
}
|
||||
} failureBlock:nil];
|
||||
}
|
||||
return self;
|
||||
}
|
||||
@@ -71,14 +86,16 @@
|
||||
[self.bgView addSubview:self.nameStackView];
|
||||
[self.bgView addSubview:self.constellationStackView];
|
||||
[self.bgView addSubview:self.signLabel];
|
||||
[self.bgView addSubview:self.livingBtn];
|
||||
[self.bgView addSubview:self.livingView];
|
||||
[self.bgView addSubview:self.chatImageView];
|
||||
[self.bgView addSubview:self.statusLabel];
|
||||
|
||||
[self.nameStackView addArrangedSubview:self.nobleImageView];
|
||||
[self.nameStackView addArrangedSubview:self.nickLabel];
|
||||
|
||||
[self.constellationStackView addArrangedSubview:self.sexBtn];
|
||||
[self.constellationStackView addArrangedSubview:self.constellationLabel];
|
||||
|
||||
|
||||
}
|
||||
|
||||
- (void)initSubViewConstraints {
|
||||
@@ -125,9 +142,19 @@
|
||||
make.bottom.mas_equalTo(self.avatarImageView.mas_bottom).offset(-4);
|
||||
}];
|
||||
|
||||
[self.livingBtn mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
[self.livingView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.right.mas_equalTo(-15);
|
||||
make.centerY.mas_equalTo(self.bgView);
|
||||
make.centerY.mas_equalTo(self.bgView).mas_offset(-8);
|
||||
make.size.mas_equalTo(CGSizeMake(20, 20));
|
||||
}];
|
||||
|
||||
[self.chatImageView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.edges.mas_equalTo(self.livingView);
|
||||
}];
|
||||
|
||||
[self.statusLabel mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.top.mas_equalTo(self.livingView.mas_bottom).offset(2);
|
||||
make.centerX.mas_equalTo(self.livingView);
|
||||
}];
|
||||
}
|
||||
|
||||
@@ -141,8 +168,9 @@
|
||||
[self.sexBtn setTitle:@"22" forState:UIControlStateNormal];
|
||||
self.constellationLabel.text = @"巨蟹座";
|
||||
self.signLabel.text = @"我是个默认的个性签名";
|
||||
[self.livingBtn setTitle:@"直播中" forState:UIControlStateNormal];
|
||||
[self.livingBtn setImage:[UIImage imageNamed:@"home_living"] forState:UIControlStateNormal];
|
||||
self.livingView.hidden = NO;
|
||||
self.statusLabel.text = @"直播中";
|
||||
// self.statusLabel.text = @"和TA聊";
|
||||
}
|
||||
|
||||
- (UIView *)bgView {
|
||||
@@ -252,15 +280,42 @@
|
||||
return _signLabel;
|
||||
}
|
||||
|
||||
- (XPButton *)livingBtn {
|
||||
if (!_livingBtn) {
|
||||
_livingBtn = [XPButton buttonWithType:UIButtonTypeCustom];
|
||||
_livingBtn.titleLabel.font = [UIFont systemFontOfSize:10 weight:UIFontWeightRegular];
|
||||
[_livingBtn setTitleColor:[ThemeColor textThirdColor] forState:UIControlStateNormal];
|
||||
_livingBtn.imagePosition = XPButtonImagePositionTop;
|
||||
_livingBtn.imageTitleSpace = 5;
|
||||
- (SVGAPlayer *)livingView {
|
||||
if (!_livingView) {
|
||||
_livingView = [[SVGAPlayer alloc] init];
|
||||
_livingView.hidden = YES;
|
||||
}
|
||||
return _livingBtn;
|
||||
return _livingView;
|
||||
}
|
||||
|
||||
- (UIImageView *)chatImageView {
|
||||
if (!_chatImageView) {
|
||||
_chatImageView = [[UIImageView alloc] init];
|
||||
_chatImageView.contentMode = UIViewContentModeScaleAspectFit;
|
||||
_chatImageView.image = [UIImage imageNamed:@"home_chat"];
|
||||
_chatImageView.hidden = YES;
|
||||
}
|
||||
return _chatImageView;
|
||||
}
|
||||
|
||||
- (UILabel *)statusLabel {
|
||||
if (!_statusLabel) {
|
||||
_statusLabel = [[UILabel alloc] init];
|
||||
_statusLabel.textColor = [ThemeColor textThirdColor];
|
||||
_statusLabel.font = [UIFont systemFontOfSize:10 weight:UIFontWeightRegular];
|
||||
}
|
||||
return _statusLabel;
|
||||
}
|
||||
|
||||
- (UIStackView *)statusStackView {
|
||||
if (!_statusStackView) {
|
||||
_statusStackView = [[UIStackView alloc] init];
|
||||
_statusStackView.axis = UILayoutConstraintAxisVertical;
|
||||
_statusStackView.distribution = UIStackViewDistributionFill;
|
||||
_statusStackView.alignment = UIStackViewAlignmentFill;
|
||||
_statusStackView.spacing = 5;
|
||||
}
|
||||
return _statusStackView;
|
||||
}
|
||||
|
||||
@end
|
||||
|
Reference in New Issue
Block a user