个播房上划加载下一个房间完成

This commit is contained in:
chenguilong
2022-07-14 17:16:33 +08:00
parent d1f86a8ae9
commit 81a0c20af6
69 changed files with 999 additions and 571 deletions

View File

@@ -31,6 +31,11 @@ NS_ASSUME_NONNULL_BEGIN
*/
- (void)hideHUD;
/**
显示加载个播房loading
*/
- (void)showAnchorLoading;
@end
@interface BaseViewController : UIViewController<BaseViewControllerProtocol>

View File

@@ -97,7 +97,12 @@
[XCHUDTool hideHUD];
}
/**
loading
*/
- (void)showAnchorLoading {
[XCHUDTool showAnchorLoading];
}
#pragma mark -
///

View File

@@ -100,6 +100,11 @@ NS_ASSUME_NONNULL_BEGIN
*/
+ (void)showGIFLoadingInView:(nullable UIView *)view bgColor:(nullable UIColor *)bgColor enabled:(BOOL)enabled;
/**
加载下一个个播房
*/
+ (void)showAnchorLoading;
/**
在窗口上显示菊花
*/

View File

@@ -9,6 +9,7 @@
#import "XCHUDTool.h"
#import "GCDHelper.h"
#import <MBProgressHUD/MBProgressHUD.h>
#import "ThemeColor.h"
#define kDelayTime 2.5
@interface XCHUDTool ()
@@ -244,6 +245,21 @@ static NSArray * _animationImages = nil;
});
}
+ (void)showAnchorLoading {
UIView *view = [UIApplication sharedApplication].keyWindow;
dispatch_main_sync_safe(^{
MBProgressHUD *hud = [MBProgressHUD showHUDAddedTo:view animated:YES];
hud.bezelView.style = MBProgressHUDBackgroundStyleSolidColor;
hud.userInteractionEnabled = NO;
hud.mode = MBProgressHUDModeCustomView;
hud.minSize = CGSizeMake(240, 180 + 16 + 30);
[hud.bezelView addSubview:[self anchorSwitchLoadingView]];
hud.bezelView.color = [UIColor clearColor];
hud.removeFromSuperViewOnHide = YES;
});
}
#pragma mark - private
+ (MBProgressHUD *)normalProgressHUD:(UIView *)view {
MBProgressHUD *hud = [MBProgressHUD showHUDAddedTo:view animated:YES];
@@ -300,6 +316,47 @@ static NSArray * _animationImages = nil;
return array;
}
+ (UIView *)anchorSwitchLoadingView {
UIView *loadingBGView = [[UIView alloc] init];
loadingBGView.layer.cornerRadius = 20;
loadingBGView.backgroundColor = [UIColor clearColor];
UIImageView *loadingImageView = [[UIImageView alloc] init];
UILabel *loadingTitleLabel = [[UILabel alloc] init];
loadingTitleLabel = [[UILabel alloc] init];
loadingTitleLabel.textColor = UIColorFromRGB(0xC9BCF2);
loadingTitleLabel.font = [UIFont systemFontOfSize:16 weight:UIFontWeightMedium];
loadingTitleLabel.text = @"加载中…";
loadingTitleLabel.textAlignment = NSTextAlignmentCenter;
[loadingBGView addSubview:loadingImageView];
[loadingBGView addSubview:loadingTitleLabel];
loadingBGView.frame = CGRectMake(0,0,240,180 + 16 + 30);
loadingImageView.frame = CGRectMake(0, 0, 240, 180);
loadingTitleLabel.frame = CGRectMake(0, CGRectGetMaxY(loadingImageView.frame) + 8, loadingBGView.frame.size.width, 15);
loadingImageView.animationImages = [self loadingAnchorAnimationImages];
[loadingImageView startAnimating];
return loadingBGView;
}
+ (NSArray<UIImage *> *)loadingAnchorAnimationImages {
NSString * countString = @"00";
NSMutableArray * imageArray= [NSMutableArray array];
for (int i = 0; i <= 23; i++) {
if (i < 10) {
countString = [NSString stringWithFormat:@"0%d", i];
} else {
countString = [NSString stringWithFormat:@"%d", i];
}
NSString * loadingImageName = [NSString stringWithFormat:@"anchorLoading_0%@", countString];
UIImage * image = [UIImage imageNamed:loadingImageName];
[imageArray addObject:image];
}
NSArray * array = [imageArray copy];
return array;
}
+ (NSArray *)animationImages {
if (_animationImages == nil) {
_animationImages = [NSArray array];