Files
yinmeng-ios/xplan-ios/Main/Room/View/ActivityContainerView/XPRoomActivityContainerView.m

98 lines
3.1 KiB
Objective-C

//
// XPRoomActivityView.m
// xplan-ios
//
// Created by 冯硕 on 2021/10/12.
//
#import "XPRoomActivityContainerView.h"
///Third
#import <Masonry/Masonry.h>
#import <SDCycleScrollView/SDCycleScrollView.h>
@interface XPRoomActivityContainerView ()<SDCycleScrollViewDelegate>
///容器
@property (nonatomic,strong) UIStackView *stackView;
///轮播图
@property (nonatomic,strong) SDCycleScrollView *cycleScrollView;
///
@property (nonatomic,strong) UIView * placeHolderView;
@end
@implementation XPRoomActivityContainerView
- (instancetype)initWithFrame:(CGRect)frame
{
self = [super initWithFrame:frame];
if (self) {
[self initSubViews];
[self initSubViewConstraints];
}
return self;
}
#pragma mark - Private Method
- (void)initMallocData {
NSArray * array = @[@"https://image.doudouyue.com//FpRJcAcPiamtkcdyDEh96c1RZGfb?imageslim", @"https://image.doudouyue.com//FpRJcAcPiamtkcdyDEh96c1RZGfb?imageslim", @"https://image.doudouyue.com//FpRJcAcPiamtkcdyDEh96c1RZGfb?imageslim"];
self.cycleScrollView.imageURLStringsGroup = array;
[self.cycleScrollView autoScroll];
}
- (void)initSubViews {
[self addSubview:self.stackView];
[self.stackView addArrangedSubview:self.cycleScrollView];
[self.stackView addArrangedSubview:self.placeHolderView];
}
- (void)initSubViewConstraints {
[self.stackView mas_makeConstraints:^(MASConstraintMaker *make) {
make.edges.mas_equalTo(self);
}];
[self.cycleScrollView mas_makeConstraints:^(MASConstraintMaker *make) {
make.size.mas_equalTo(CGSizeMake(65, 65));
}];
}
#pragma mark - Getters And Setters
- (SDCycleScrollView *)cycleScrollView {
if (!_cycleScrollView) {
_cycleScrollView = [SDCycleScrollView cycleScrollViewWithFrame:CGRectZero delegate:self placeholderImage:nil];
_cycleScrollView.pageControlAliment = SDCycleScrollViewPageContolAlimentCenter;
_cycleScrollView.currentPageDotColor = [UIColor whiteColor];
_cycleScrollView.pageDotColor = [UIColor colorWithWhite:1 alpha:0.15];
_cycleScrollView.currentPageDotImage = [UIImage imageNamed:@"room_activity_banner_select"];
_cycleScrollView.pageDotImage = [UIImage imageNamed:@"room_activity_banner_normal"];
_cycleScrollView.backgroundColor = [UIColor colorWithWhite:1 alpha:0.00];
_cycleScrollView.bannerImageViewContentMode = UIViewContentModeScaleAspectFit;
_cycleScrollView.pageControlBottomOffset = -20;
}
return _cycleScrollView;
}
- (UIView *)placeHolderView {
if (!_placeHolderView) {
_placeHolderView = [[UIView alloc] init];
_placeHolderView.backgroundColor = [UIColor clearColor];
[_placeHolderView setContentHuggingPriority:UILayoutPriorityDragThatCanResizeScene forAxis:UILayoutConstraintAxisHorizontal];
[_placeHolderView setContentCompressionResistancePriority:UILayoutPriorityFittingSizeLevel forAxis:UILayoutConstraintAxisHorizontal];
}
return _placeHolderView;
}
- (UIStackView *)stackView {
if (!_stackView) {
_stackView = [[UIStackView alloc] init];
_stackView.axis = UILayoutConstraintAxisVertical;
_stackView.distribution = UIStackViewDistributionFill;
_stackView.alignment = UIStackViewAlignmentCenter;
_stackView.spacing = 10;
}
return _stackView;
}
@end