个播房可以向上滚动

This commit is contained in:
fengshuo
2022-08-10 21:39:39 +08:00
parent 7ea61f988d
commit 1fa07e3f27
7 changed files with 226 additions and 91 deletions

View File

@@ -54,6 +54,9 @@ NS_ASSUME_NONNULL_BEGIN
/// @param roomUid 房间的uid /// @param roomUid 房间的uid
- (void)getCycleAnchorRoomList:(NSString *)roomUid; - (void)getCycleAnchorRoomList:(NSString *)roomUid;
///获取当前房间是否有效
- (void)getCurrentRoomInfo:(NSString *)roomUid;
@end @end
NS_ASSUME_NONNULL_END NS_ASSUME_NONNULL_END

View File

@@ -216,4 +216,13 @@
} roomUid:roomUid]; } roomUid:roomUid];
} }
- (void)getCurrentRoomInfo:(NSString *)roomUid {
[Api getRoomInfo:[self createHttpCompletion:^(BaseModel * _Nonnull data) {
RoomInfoModel * roomInfo = [RoomInfoModel modelWithDictionary:data.data];
[[self getView] getCurrentRoomInfo:roomInfo];
} fail:^(NSInteger code, NSString * _Nullable msg) {
[[self getView] getCurrentRoomInfo:nil];
}] uid:roomUid intoUid:@""];
}
@end @end

View File

@@ -25,7 +25,8 @@ NS_ASSUME_NONNULL_BEGIN
- (void)getRoomSuperAdminScuccess:(NSArray *)list; - (void)getRoomSuperAdminScuccess:(NSArray *)list;
///获取下一个个播房成功 ///获取下一个个播房成功
- (void)getNextAnchorRoomSuccess:(RoomInfoModel *)roomInfo; - (void)getNextAnchorRoomSuccess:(RoomInfoModel *)roomInfo;
///获取当前房间的信息
- (void)getCurrentRoomInfo:(RoomInfoModel *_Nullable)roomInfo;
@end @end
NS_ASSUME_NONNULL_END NS_ASSUME_NONNULL_END

View File

@@ -7,11 +7,11 @@
#import <UIKit/UIKit.h> #import <UIKit/UIKit.h>
#import "NetImageView.h" #import "NetImageView.h"
@class AnchorRoomScrollView; @class AnchorRoomScrollView;
@protocol AnchorRoomScrollViewDelegate <NSObject> @protocol AnchorRoomScrollViewDelegate <NSObject>
///滚动到上一个时回调
- (void)anchorScrollViewScrollToPrevious:(AnchorRoomScrollView *)anchorScrollView;
///滚动到下一个时回调 ///滚动到下一个时回调
- (void)anchorScrollViewScrollToNext:(AnchorRoomScrollView *)anchorScrollView; - (void)anchorScrollViewScrollToNext:(AnchorRoomScrollView *)anchorScrollView;
///开始停止 ///开始停止
@@ -24,7 +24,12 @@
@interface AnchorRoomScrollView : UIScrollView @interface AnchorRoomScrollView : UIScrollView
@property (nonatomic, assign) id<AnchorRoomScrollViewDelegate> anchorScrollDelegate; @property (nonatomic, assign) id<AnchorRoomScrollViewDelegate> anchorScrollDelegate;
@property (nonatomic, strong) NetImageView *middleImageView; @property (nonatomic, strong) UIView *middleImageView;
@property (nonatomic,assign) BOOL isCanScrollTop;
///是不是下一个
@property (nonatomic,assign) BOOL isScrollNext;
///是不是上一个
@property (nonatomic,assign) BOOL isScrollPrevious;
- (instancetype)initWithFrame:(CGRect)frame; - (instancetype)initWithFrame:(CGRect)frame;

View File

@@ -9,20 +9,21 @@
#import "XPMacro.h" #import "XPMacro.h"
#import "RoomInfoModel.h" #import "RoomInfoModel.h"
//SVGA //SVGA
#import "SVGA.h"
#import "SVGAParserManager.h" #import "SVGAParserManager.h"
#import <ReactiveObjC/ReactiveObjC.h> #import <ReactiveObjC/ReactiveObjC.h>
@interface AnchorRoomScrollView()<UIScrollViewDelegate, UIGestureRecognizerDelegate> @interface AnchorRoomScrollView()<UIScrollViewDelegate, UIGestureRecognizerDelegate>
/// ///
@property (nonatomic, strong) SVGAImageView *svgDisplayView; @property (nonatomic, strong) SVGAImageView *middleDisplayView;
@property (nonatomic, strong) SVGAParserManager *parserManager; @property (nonatomic, strong) SVGAParserManager *parserManager;
@property (nonatomic, strong) NetImageView *downImageView; @property (nonatomic, strong) SVGAImageView *topDisplayView;
@property (nonatomic, strong) SVGAImageView *downDisplayView;
@property (nonatomic, assign) BOOL animatePlay; @property (nonatomic, assign) BOOL animatePlay;
@end @end
@implementation AnchorRoomScrollView @implementation AnchorRoomScrollView
@@ -31,105 +32,126 @@
{ {
self = [super initWithFrame:frame]; self = [super initWithFrame:frame];
if(self) if(self)
{ {
self.contentSize = CGSizeMake(0, frame.size.height * 2);
self.pagingEnabled = YES; self.pagingEnabled = YES;
self.showsHorizontalScrollIndicator = NO; self.showsHorizontalScrollIndicator = NO;
self.showsVerticalScrollIndicator = NO; self.showsVerticalScrollIndicator = NO;
self.delegate = self; self.delegate = self;
self.contentInsetAdjustmentBehavior = UIScrollViewContentInsetAdjustmentNever;
self.alwaysBounceVertical = NO; self.alwaysBounceVertical = NO;
self.bounces = NO; self.bounces = NO;
self.delaysContentTouches = NO; self.delaysContentTouches = NO;
self.scrollsToTop = NO; self.scrollsToTop = NO;
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(roomMessageTabelViewStopScroll) name:@"roomMessageTabelViewStopScroll" object:nil]; [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(roomMessageTabelViewStopScroll) name:@"roomMessageTabelViewStopScroll" object:nil];
self.isCanScrollTop = NO;
[self addSubview:self.topDisplayView];
[self addSubview:self.middleDisplayView];
[self addSubview:self.downDisplayView];
NetImageConfig * config = [[NetImageConfig alloc] init];
config.placeHolder = [UIImage imageNamed:@"room_background"];
self.middleImageView = [[NetImageView alloc] initWithConfig:config];
self.middleImageView.frame = CGRectMake(0, 0, frame.size.width, frame.size.height);
self.middleImageView.contentMode = UIViewContentModeScaleAspectFill;
[self.middleImageView clipsToBounds];
self.downImageView = [[NetImageView alloc] initWithConfig:config];
self.downImageView.frame = CGRectMake(0, frame.size.height, frame.size.width, frame.size.height);
self.downImageView.contentMode = UIViewContentModeScaleAspectFill;
[self.downImageView clipsToBounds];
[self addSubview:self.middleImageView];
[self addSubview:self.downImageView];
[self addSubview:self.svgDisplayView];
self.svgDisplayView.frame = CGRectMake(0, frame.size.height, frame.size.width, frame.size.height);
} }
return self; return self;
} }
- (void)startAnimate { - (void)startAnimate:(SVGAImageView *)displayView {
self.animatePlay = YES; self.animatePlay = YES;
@weakify(self);
NSString *bgString = [[NSBundle mainBundle] pathForResource:@"anchor_room_bg" ofType:@"svga"]; NSString *bgString = [[NSBundle mainBundle] pathForResource:@"anchor_room_bg" ofType:@"svga"];
NSURL *bgUrl = [NSURL fileURLWithPath:bgString]; NSURL *bgUrl = [NSURL fileURLWithPath:bgString];
[self.parserManager loadSvgaWithURL:bgUrl completionBlock:^(SVGAVideoEntity * _Nullable videoItem) { [self.parserManager loadSvgaWithURL:bgUrl completionBlock:^(SVGAVideoEntity * _Nullable videoItem) {
@strongify(self);
if (videoItem != nil) { if (videoItem != nil) {
CGFloat width = videoItem.videoSize.width; CGFloat width = videoItem.videoSize.width;
CGFloat height = videoItem.videoSize.height; CGFloat height = videoItem.videoSize.height;
if (width > height) { if (width > height) {
self.svgDisplayView.contentMode = UIViewContentModeScaleAspectFit; displayView.contentMode = UIViewContentModeScaleAspectFit;
} else {// } else {//
CGFloat resizeH = KScreenWidth * height / width;// CGFloat resizeH = KScreenWidth * height / width;//
if (resizeH > KScreenHeight) {// if (resizeH > KScreenHeight) {//
self.svgDisplayView.contentMode = UIViewContentModeScaleAspectFill; displayView.contentMode = UIViewContentModeScaleAspectFill;
} else {// } else {//
self.svgDisplayView.contentMode = UIViewContentModeScaleAspectFit; displayView.contentMode = UIViewContentModeScaleAspectFit;
} }
} }
self.svgDisplayView.loops = INT_MAX; displayView.loops = INT_MAX;
self.svgDisplayView.clearsAfterStop = NO; displayView.clearsAfterStop = NO;
self.svgDisplayView.videoItem = videoItem; displayView.videoItem = videoItem;
[self.svgDisplayView startAnimation]; [displayView startAnimation];
} }
} failureBlock:^(NSError * _Nullable error) { } failureBlock:^(NSError * _Nullable error) {
}]; }];
} }
- (void)stopAnimate { - (void)stopAnimate {
[self.svgDisplayView stopAnimation]; [self.middleDisplayView stopAnimation];
[self.topDisplayView stopAnimation];
[self.downDisplayView stopAnimation];
self.animatePlay = NO; self.animatePlay = NO;
NSLog(@"动画结束了");
} }
- (void)roomMessageTabelViewStopScroll { - (void)roomMessageTabelViewStopScroll {
self.scrollEnabled = YES; self.scrollEnabled = YES;
} }
- (void)switchPlayer:(UIScrollView*)scrollView - (void)switchPlayer:(UIScrollView*)scrollView {
{ CGFloat offset = scrollView.contentOffset.y;
CGFloat offset = scrollView.contentOffset.y; if (offset >= self.frame.size.height * 2)
if (offset >= self.frame.size.height) {
{ if (self.anchorScrollDelegate && [self.anchorScrollDelegate respondsToSelector:@selector(anchorScrollViewScrollToNext:)]) {
if (self.anchorScrollDelegate && [self.anchorScrollDelegate respondsToSelector:@selector(anchorScrollViewScrollToNext:)]) { [self.anchorScrollDelegate anchorScrollViewScrollToNext:self];
[self.anchorScrollDelegate anchorScrollViewScrollToNext:self]; }
} [self stopAnimate];
[self stopAnimate]; } else if (offset <= 0) {
} if (self.anchorScrollDelegate && [self.anchorScrollDelegate respondsToSelector:@selector(anchorScrollViewScrollToPrevious:)]) {
[self.anchorScrollDelegate anchorScrollViewScrollToPrevious:self];
}
[self stopAnimate];
}
} }
-(void)scrollViewDidScroll:(UIScrollView *)scrollView { -(void)scrollViewDidScroll:(UIScrollView *)scrollView {
if (scrollView.contentOffset.y > 0) { NSLog(@"滚动的Y:%.2f", scrollView.contentOffset.y);
if (scrollView.contentOffset.y > KScreenHeight) {///
if (scrollView.contentOffset.y <= (KScreenHeight * 1.5)) {
return;
}
if (!self.animatePlay) { if (!self.animatePlay) {
[self startAnimate]; [self startAnimate:self.downDisplayView];
} }
if (self.anchorScrollDelegate && [self.anchorScrollDelegate respondsToSelector:@selector(anchorScrollVieEndScroll:)]) { } else {///
[self.anchorScrollDelegate anchorScrollVieStartScroll:self];
} if (scrollView.contentOffset.y > (KScreenHeight * 0.5)) {
} else if (scrollView.contentOffset.y == 0) { return;
if (self.anchorScrollDelegate && [self.anchorScrollDelegate respondsToSelector:@selector(anchorScrollVieEndScroll:)]) { }
[self.anchorScrollDelegate anchorScrollVieEndScroll:self];
} if (!self.animatePlay) {
} [self startAnimate:self.topDisplayView];
[self switchPlayer:scrollView]; }
}
} }
- (void)scrollViewDidEndDecelerating:(UIScrollView *)scrollView {
if (self.isCanScrollTop) {
if (scrollView.contentOffset.y >= KScreenHeight * 2) {
if (self.anchorScrollDelegate && [self.anchorScrollDelegate respondsToSelector:@selector(anchorScrollViewScrollToNext:)]) {
[self.anchorScrollDelegate anchorScrollViewScrollToNext:self];
}
} else if(scrollView.contentOffset.y <= 0) {
if (self.anchorScrollDelegate && [self.anchorScrollDelegate respondsToSelector:@selector(anchorScrollViewScrollToPrevious:)]) {
[self.anchorScrollDelegate anchorScrollViewScrollToPrevious:self];
}
}
} else {
if (scrollView.contentOffset.y >= KScreenHeight) {
if (self.anchorScrollDelegate && [self.anchorScrollDelegate respondsToSelector:@selector(anchorScrollViewScrollToNext:)]) {
[self.anchorScrollDelegate anchorScrollViewScrollToNext:self];
}
}
}
[self stopAnimate];
NSLog(@"scrollViewDidEndDeceleratingY:%.2f", scrollView.contentOffset.y);
}
- (BOOL)gestureRecognizer:(UIGestureRecognizer *)gestureRecognizer shouldRecognizeSimultaneouslyWithGestureRecognizer:(UIGestureRecognizer *)otherGestureRecognizer { - (BOOL)gestureRecognizer:(UIGestureRecognizer *)gestureRecognizer shouldRecognizeSimultaneouslyWithGestureRecognizer:(UIGestureRecognizer *)otherGestureRecognizer {
///666 ///666
if (otherGestureRecognizer.view.tag == 666) { if (otherGestureRecognizer.view.tag == 666) {
@@ -140,14 +162,53 @@
return YES; return YES;
} }
- (SVGAImageView *)svgDisplayView { - (void)setIsCanScrollTop:(BOOL)isCanScrollTop {
if (_svgDisplayView == nil) { _isCanScrollTop = isCanScrollTop;
_svgDisplayView = [[SVGAImageView alloc] init]; CGRect frame = self.frame;
_svgDisplayView.contentMode = UIViewContentModeScaleToFill; if (_isCanScrollTop) {
_svgDisplayView.userInteractionEnabled = NO; self.contentSize = CGSizeMake(0, frame.size.height * 3);
_svgDisplayView.backgroundColor = [UIColor clearColor]; self.topDisplayView.frame = CGRectMake(0, 0, frame.size.width, frame.size.height);
self.middleDisplayView.frame = CGRectMake(0, frame.size.height, frame.size.width, frame.size.height);
self.downDisplayView.frame = CGRectMake(0, frame.size.height * 2, frame.size.width, frame.size.height);
self.middleImageView = self.middleDisplayView;
} else {
self.contentSize = CGSizeMake(0, frame.size.height * 2);
self.topDisplayView.frame = CGRectMake(0, 0, frame.size.width, frame.size.height);
self.middleDisplayView.frame = CGRectMake(0, 0, frame.size.width, frame.size.height);
self.downDisplayView.frame = CGRectMake(0, frame.size.height, frame.size.width, frame.size.height);
self.middleImageView = self.middleDisplayView;
}
}
- (SVGAImageView *)middleDisplayView {
if (_middleDisplayView == nil) {
_middleDisplayView = [[SVGAImageView alloc] init];
_middleDisplayView.contentMode = UIViewContentModeScaleToFill;
_middleDisplayView.userInteractionEnabled = NO;
_middleDisplayView.backgroundColor = [UIColor clearColor];
} }
return _svgDisplayView; return _middleDisplayView;
}
- (SVGAImageView *)topDisplayView {
if (_topDisplayView == nil) {
_topDisplayView = [[SVGAImageView alloc] init];
_topDisplayView.contentMode = UIViewContentModeScaleToFill;
_topDisplayView.userInteractionEnabled = NO;
_topDisplayView.backgroundColor = [UIColor clearColor];
}
return _topDisplayView;
}
- (SVGAImageView *)downDisplayView {
if (_downDisplayView == nil) {
_downDisplayView = [[SVGAImageView alloc] init];
_downDisplayView.contentMode = UIViewContentModeScaleToFill;
_downDisplayView.userInteractionEnabled = NO;
_downDisplayView.backgroundColor = [UIColor clearColor];
}
return _downDisplayView;
} }
- (SVGAParserManager *)parserManager { - (SVGAParserManager *)parserManager {

View File

@@ -84,7 +84,7 @@
[XCHUDTool showErrorWithMessage:@"房间公屏已关闭"]; [XCHUDTool showErrorWithMessage:@"房间公屏已关闭"];
return; return;
} }
[XPRoomSendTextView showTextView:self.superview delegate:self.delegate atUid:nil atNick:nil]; [XPRoomSendTextView showTextView:[UIApplication sharedApplication].delegate.window delegate:self.delegate atUid:nil atNick:nil];
} }
break; break;

View File

@@ -111,6 +111,11 @@ NSString * const kHadQuitOtherRoomKey = @"kHadQuitOtherRoomKey";//是否退出
/// ///
@property (nonatomic, strong) AnchorRoomSrollTipView *anchorScrollTipView; @property (nonatomic, strong) AnchorRoomSrollTipView *anchorScrollTipView;
///
@property (nonatomic,strong) NSMutableArray<NSString *> *anchorRoomList;
///
@property (nonatomic,assign) BOOL anchorIndex;
@end @end
@implementation XPRoomViewController @implementation XPRoomViewController
@@ -193,7 +198,7 @@ NSString * const kHadQuitOtherRoomKey = @"kHadQuitOtherRoomKey";//是否退出
} }
- (void)viewDidLoad { - (void)viewDidLoad {
[super viewDidLoad]; [super viewDidLoad];
[self exitOldRoom]; [self exitOldRoom];
[self initSubViews]; [self initSubViews];
[self initSubViewConstraints]; [self initSubViewConstraints];
@@ -308,8 +313,8 @@ NSString * const kHadQuitOtherRoomKey = @"kHadQuitOtherRoomKey";//是否退出
make.right.equalTo(self.activityContainerView.mas_left).offset(-10); make.right.equalTo(self.activityContainerView.mas_left).offset(-10);
}]; }];
[self.menuContainerView mas_makeConstraints:^(MASConstraintMaker *make) { [self.menuContainerView mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.right.mas_equalTo(self.view); make.left.right.mas_equalTo(self.anchorScrollView.middleImageView);
make.bottom.mas_equalTo(-kSafeAreaBottomHeight- 8); make.bottom.mas_equalTo(self.anchorScrollView.middleImageView).offset(-kSafeAreaBottomHeight- 8);
make.height.mas_equalTo(40); make.height.mas_equalTo(40);
}]; }];
[self.activityContainerView mas_makeConstraints:^(MASConstraintMaker *make) { [self.activityContainerView mas_makeConstraints:^(MASConstraintMaker *make) {
@@ -775,9 +780,14 @@ NSString * const kHadQuitOtherRoomKey = @"kHadQuitOtherRoomKey";//是否退出
///) ///)
- (void)getNextAnchorRoomSuccess:(RoomInfoModel *)roomInfo { - (void)getNextAnchorRoomSuccess:(RoomInfoModel *)roomInfo {
self.anchorScrollView.contentOffset = CGPointMake(0, 0); self.anchorScrollView.contentOffset = CGPointMake(0, KScreenHeight);
[self hideHUD]; [self hideHUD];
if (roomInfo) { // if (roomInfo) { //
NSString * roomUid = [NSString stringWithFormat:@"%ld", roomInfo.uid];
if (![self.anchorRoomList containsObject:[NSString stringWithFormat:@"%ld", roomInfo.uid]]) {
[self.anchorRoomList addObject:roomUid];
}
self.anchorIndex = self.anchorRoomList.count -1;
//1退 //1退
self.isRequestSuperAdmin = NO; self.isRequestSuperAdmin = NO;
[self exitOldRoom]; [self exitOldRoom];
@@ -807,6 +817,43 @@ NSString * const kHadQuitOtherRoomKey = @"kHadQuitOtherRoomKey";//是否退出
} else { } else {
[self showErrorToast:@"已经到底啦~自动为您返回当前房间"]; [self showErrorToast:@"已经到底啦~自动为您返回当前房间"];
} }
self.anchorScrollView.isScrollNext = NO;
}
- (void)getCurrentRoomInfo:(RoomInfoModel *)roomInfo {
[self hideHUD];
self.anchorScrollView.contentOffset = CGPointMake(0, KScreenHeight);
if (roomInfo && roomInfo.valid) {
//1退
self.isRequestSuperAdmin = NO;
[self exitOldRoom];
[self.presenter exitNIMRoom:[NSString stringWithFormat:@"%ld", self.roomInfo.roomId]];
[[XPRoomMiniManager shareManager] resetLocalMessage];
[[RtcManager instance] exitRoom];
[self.presenter reportUserOutRoom:[NSString stringWithFormat:@"%ld", self.roomInfo.uid]];
//2
[self.backContainerView removeFromSuperview];
[self.stageView removeFromSuperview];
[self.messageContainerView removeFromSuperview];
[self.activityContainerView removeFromSuperview];
[self.roomHeaderView removeFromSuperview];
[self.functionView removeFromSuperview];
self.functionView = nil;
self.messageContainerView = nil;
self.stageView = nil;
[self.menuContainerView removeFromSuperview];
self.menuContainerView = nil;
//3
self.roomUid = [NSString stringWithFormat:@"%zd", roomInfo.uid];
[self.presenter initEnterRoom:self.roomUid user:[AccountInfoStorage instance].getUid];
///
[self.presenter getNormalGiftList:self.roomUid];
///
[self.presenter getRoomSuperAdmin:self.roomUid];
} else {
[self showErrorToast:@"已经到顶啦~自动为您返回当前房间"];
}
} }
/// ///
@@ -825,7 +872,7 @@ NSString * const kHadQuitOtherRoomKey = @"kHadQuitOtherRoomKey";//是否退出
} else { } else {
self.roomInfo.datingState = self.roomInfo.roomModeType == RoomModeType_Open_Blind ? RoomDatingStateChangeType_Open : RoomDatingStateChangeType_Normal; self.roomInfo.datingState = self.roomInfo.roomModeType == RoomModeType_Open_Blind ? RoomDatingStateChangeType_Open : RoomDatingStateChangeType_Normal;
if (!self.anchorScrollView.superview) { if (!self.anchorScrollView.superview) {
[self.view insertSubview:self.anchorScrollView belowSubview:self.menuContainerView]; [self.view addSubview:self.anchorScrollView];
} }
[self.backContainerView removeFromSuperview]; [self.backContainerView removeFromSuperview];
[self.stageView removeFromSuperview]; [self.stageView removeFromSuperview];
@@ -833,6 +880,7 @@ NSString * const kHadQuitOtherRoomKey = @"kHadQuitOtherRoomKey";//是否退出
[self.activityContainerView removeFromSuperview]; [self.activityContainerView removeFromSuperview];
[self.roomHeaderView removeFromSuperview]; [self.roomHeaderView removeFromSuperview];
[self.functionView removeFromSuperview]; [self.functionView removeFromSuperview];
[self.menuContainerView removeFromSuperview];
[self.anchorScrollView addSubview:self.backContainerView]; [self.anchorScrollView addSubview:self.backContainerView];
[self.anchorScrollView addSubview:self.stageView]; [self.anchorScrollView addSubview:self.stageView];
@@ -840,9 +888,8 @@ NSString * const kHadQuitOtherRoomKey = @"kHadQuitOtherRoomKey";//是否退出
[self.anchorScrollView addSubview:self.activityContainerView]; [self.anchorScrollView addSubview:self.activityContainerView];
[self.anchorScrollView addSubview:self.roomHeaderView]; [self.anchorScrollView addSubview:self.roomHeaderView];
[self.anchorScrollView addSubview:self.functionView]; [self.anchorScrollView addSubview:self.functionView];
if (!self.menuContainerView.superview) { [self.anchorScrollView addSubview:self.menuContainerView];
[self.view addSubview:self.menuContainerView];
}
[self updateViewConstraintsOnAnchorRoom]; [self updateViewConstraintsOnAnchorRoom];
[self changeStageViewOnAnchorRoom]; [self changeStageViewOnAnchorRoom];
@@ -1376,21 +1423,21 @@ NSString * const kHadQuitOtherRoomKey = @"kHadQuitOtherRoomKey";//是否退出
[self.presenter getCycleAnchorRoomList:[NSString stringWithFormat:@"%ld", self.roomInfo.uid]]; [self.presenter getCycleAnchorRoomList:[NSString stringWithFormat:@"%ld", self.roomInfo.uid]];
} }
///
- (void)anchorScrollVieStartScroll:(AnchorRoomScrollView *)anchorScrollView {
if (self.menuContainerView.alpha == 0) {
return;
}
[UIView animateWithDuration:0.2 animations:^{
self.menuContainerView.alpha = 0;
}];
}
/// - (void)anchorScrollViewScrollToPrevious:(AnchorRoomScrollView *)anchorScrollView {
- (void)anchorScrollVieEndScroll:(AnchorRoomScrollView *)anchorScrollView { if (!self || self.anchorRoomList.count <= 0) {
[UIView animateWithDuration:0.2 animations:^{ return;
self.menuContainerView.alpha = 1; }
}]; [self.view endEditing:YES];
[self showAnchorLoading];
if (self.anchorIndex < self.anchorRoomList.count) {
NSString * roomUid = [self.anchorRoomList objectAtIndex:self.anchorIndex];
[self.presenter getCurrentRoomInfo:roomUid];
self.anchorIndex --;
}else {
[self showErrorToast:@"已经到顶啦~自动为您返回当前房间"];
self.anchorScrollView.contentOffset = CGPointMake(0, KScreenHeight);
}
} }
#pragma mark - XPRoomSettingInputViewDelegate #pragma mark - XPRoomSettingInputViewDelegate
@@ -1536,6 +1583,9 @@ NSString * const kHadQuitOtherRoomKey = @"kHadQuitOtherRoomKey";//是否退出
if (!_anchorScrollView) { if (!_anchorScrollView) {
_anchorScrollView = [[AnchorRoomScrollView alloc] initWithFrame:CGRectMake(0, 0, KScreenWidth, KScreenHeight)]; _anchorScrollView = [[AnchorRoomScrollView alloc] initWithFrame:CGRectMake(0, 0, KScreenWidth, KScreenHeight)];
_anchorScrollView.anchorScrollDelegate = self; _anchorScrollView.anchorScrollDelegate = self;
if (@available(iOS 11.0, *)) {
_anchorScrollView.contentInsetAdjustmentBehavior = UIScrollViewContentInsetAdjustmentNever;
}
} }
return _anchorScrollView; return _anchorScrollView;
} }
@@ -1547,5 +1597,11 @@ NSString * const kHadQuitOtherRoomKey = @"kHadQuitOtherRoomKey";//是否退出
return _anchorScrollTipView; return _anchorScrollTipView;
} }
- (NSMutableArray<NSString *> *)anchorRoomList {
if (!_anchorRoomList) {
_anchorRoomList = [NSMutableArray array];
}
return _anchorRoomList;
}
@end @end