//
|
// PPTVNavView.m
|
// BuWanVideo2.0
|
//
|
// Created by Aeline on 2021/5/15.
|
// Copyright © 2021 com.yeshi.buwansheque.ios. All rights reserved.
|
//
|
|
#import "PPTVNavView.h"
|
|
@interface PPTVNavView ()
|
@property (nonatomic, nullable, strong) UIView *viewBG;
|
@property (nonatomic, nullable, strong) UIButton *buttonBack;
|
@property (nonatomic, nullable, strong) UIButton *buutonRight;
|
@property (nonatomic, nullable, strong) UILabel *labelTitle;
|
@property (nonatomic, nullable, strong) UILabel *labelContent;
|
@end
|
|
@implementation PPTVNavView
|
|
- (instancetype)initWithFrame:(CGRect)frame
|
{
|
self = [super initWithFrame:frame];
|
if (self) {
|
self.backgroundColor = [UIColor whiteColor];
|
[self setupViewConfig];
|
}
|
return self;
|
}
|
|
- (void)setupViewConfig {
|
[self addSubview:self.viewBG];
|
[self.viewBG addSubview:self.buttonBack];
|
[self.viewBG addSubview:self.buutonRight];
|
[self.viewBG addSubview:self.labelTitle];
|
[self.viewBG addSubview:self.labelContent];
|
|
self.viewBG.sd_layout.leftSpaceToView(self, 0).topSpaceToView(self, kStatusBarH).rightSpaceToView(self, 0).bottomSpaceToView(self, 0);
|
self.buttonBack.sd_layout.leftSpaceToView(self.viewBG, 10).centerYEqualToView(self.viewBG).widthIs(30).heightIs(30);
|
self.buutonRight.sd_layout.rightSpaceToView(self.viewBG, 10).centerYEqualToView(self.viewBG).widthIs(30).heightIs(30);
|
|
self.labelTitle.sd_layout.leftSpaceToView(self.buttonBack, 10).topSpaceToView(self.viewBG, 3).rightSpaceToView(self.buutonRight, 0).autoHeightRatio(0);
|
self.labelContent.sd_layout.leftSpaceToView(self.buttonBack, 10).topSpaceToView(self.labelTitle, -3).rightSpaceToView(self.buutonRight, 0).widthIs(KScreenW - 90);
|
}
|
|
- (void)back {
|
if (_delegate && [_delegate respondsToSelector:@selector(backVc)]) {
|
[_delegate backVc];
|
}
|
}
|
|
- (void)more {
|
if (_delegate && [_delegate respondsToSelector:@selector(moreSelect)]) {
|
[_delegate moreSelect];
|
}
|
}
|
|
- (void)setName:(NSString *)name {
|
self.labelTitle.text = name;
|
}
|
|
- (void)setContent:(NSString *)content {
|
self.labelContent.text = content;
|
}
|
|
- (UIView *)viewBG {
|
if (!_viewBG) {
|
_viewBG = [[UIView alloc] init];
|
}
|
return _viewBG;
|
}
|
|
- (UIButton *)buttonBack {
|
if (!_buttonBack) {
|
_buttonBack = [UIButton buttonWithType:UIButtonTypeCustom];
|
[_buttonBack setImage:[UIImage imageNamed:@"详情页面返回"] forState:UIControlStateNormal];
|
[_buttonBack addTarget:self action:@selector(back) forControlEvents:UIControlEventTouchUpInside];
|
}
|
return _buttonBack;
|
}
|
|
- (UIButton *)buutonRight {
|
if (!_buutonRight) {
|
_buutonRight = [UIButton buttonWithType:UIButtonTypeCustom];
|
[_buutonRight setImage:[UIImage imageNamed:@"pptv_more"] forState:UIControlStateNormal];
|
[_buutonRight addTarget:self action:@selector(more) forControlEvents:UIControlEventTouchUpInside];
|
}
|
return _buutonRight;
|
}
|
|
- (UILabel *)labelTitle {
|
if (!_labelTitle) {
|
_labelTitle = [[UILabel alloc] init];
|
_labelTitle.font = [UIFont systemFontOfSize:17];
|
_labelTitle.textColor =UIColorFromRGBValue(0x000000);
|
_labelTitle.textAlignment = NSTextAlignmentLeft;
|
}
|
return _labelTitle;
|
}
|
|
- (UILabel *)labelContent {
|
if (!_labelContent) {
|
_labelContent = [[UILabel alloc] init];
|
_labelContent.font = [UIFont systemFontOfSize:10];
|
_labelContent.textColor =UIColorFromRGBValue(0x999999);
|
_labelContent.textAlignment = NSTextAlignmentLeft;
|
}
|
return _labelContent;
|
}
|
@end
|