Commit 3b5e57c3 by pierce

修复一些UI bug

parent 29e06b39
Showing with 95 additions and 93 deletions
......@@ -13,10 +13,10 @@
#import "FUSMainThreadLockOperation.h"
#define BTN_HEIGHT 45 // 按钮的高度
#define VIEW_MARGIN 30 // 上下左右的边距
#define TITLE_DETAIL_SPACE 0 // 标题和内容的间距
#define DETAIL_BUTTON_SACE 10 // 内容到下面按钮的距离
#define BTN_HEIGHT 38 // 按钮的高度
#define VIEW_MARGIN 29 // 上下左右的边距
#define TITLE_DETAIL_SPACE 6 // 标题和内容的间距
#define DETAIL_BUTTON_SACE 25 // 内容到下面按钮的距离
@interface FUSAlertView ()
......@@ -48,9 +48,6 @@
// 同步操作对象
@property (nonatomic, strong) FUSMainThreadLockOperation *mainLockOperation;
// 是否粉色风格的弹窗
@property (nonatomic, assign) BOOL isPinkStyle;
@end
@implementation FUSAlertView
......@@ -75,28 +72,27 @@ static FUSAlertView *sharedAlertView = nil;
_bgImageView = [[UIImageView alloc] init];
_bgImageView.contentMode = UIViewContentModeScaleToFill;
_bgImageView.image = UIImage.fus_alertBg;
_bgImageView.backgroundColor = UIColor.fus_appBGColor;
_bgImageView.layer.cornerRadius = 21;
_bgImageView.layer.masksToBounds = YES;
// _bgImageView.image = UIImage.fus_alertBg;
[_bgView addSubview:_bgImageView];
_titleLabel = [[UILabel alloc] init];
_titleLabel.font = [UIFont systemFontOfSize:16 weight:UIFontWeightBold];
_titleLabel.font = [UIFont fus_themeBoldFont:19];
_titleLabel.numberOfLines = 0;
_titleLabel.textColor = [UIColor whiteColor];
_titleLabel.textColor = UIColor.fus_textColorRich;
_titleLabel.textAlignment = NSTextAlignmentCenter;
[_bgView addSubview:_titleLabel];
_detailLabel = [[UILabel alloc] init];
_detailLabel.font = [UIFont systemFontOfSize:13 weight:UIFontWeightRegular];
_detailLabel.font = [UIFont fus_themeFont:14];
_detailLabel.numberOfLines = 0;
_detailLabel.textAlignment = NSTextAlignmentCenter;
_detailLabel.textColor = [UIColor colorWithHex:@"#E6E6E6"];
_detailLabel.textColor = [UIColor colorWithHex:@"333333"];
[_bgView addSubview:_detailLabel];
_cancelBtn = [UIButton buttonWithType:UIButtonTypeSystem];
_cancelBtn.titleLabel.font = [UIFont systemFontOfSize:15 weight:UIFontWeightRegular];
[_cancelBtn setTitleColor:[UIColor colorWithHex:@"#58DBD7"] forState:UIControlStateNormal];
[_cancelBtn addTarget:self action:@selector(onClickBtn:) forControlEvents:UIControlEventTouchUpInside];
_cancelBtn.tag = 0;
[self fus_resetCancelBtn];
[_bgView addSubview:_cancelBtn];
_noMoreTipBtn = [UIButton buttonWithType:UIButtonTypeCustom];
......@@ -118,14 +114,7 @@ static FUSAlertView *sharedAlertView = nil;
- (void)fus_setConfirmBtnWithArray:(NSArray *)titlesArray {
_cancelBtn.titleLabel.font = [UIFont systemFontOfSize:15 weight:UIFontWeightRegular];
if (self.isPinkStyle) {
[_cancelBtn setTitleColor:[UIColor colorWithHex:@"#FF668E"] forState:UIControlStateNormal];
} else {
[_cancelBtn setTitleColor:[UIColor colorWithHex:@"#58DBD7"] forState:UIControlStateNormal];
}
[_cancelBtn addTarget:self action:@selector(onClickBtn:) forControlEvents:UIControlEventTouchUpInside];
_cancelBtn.tag = 0;
[self fus_resetCancelBtn];
[_bgView addSubview:_cancelBtn];
......@@ -146,17 +135,16 @@ static FUSAlertView *sharedAlertView = nil;
// btn = self.confirmBtnArr[i];
// }else{
btn = [UIButton buttonWithType:UIButtonTypeSystem];
btn.titleLabel.font = [UIFont systemFontOfSize:15 weight:UIFontWeightSemibold];
btn.titleLabel.font = [UIFont fus_themeMediumFont:15];
// }
NSString *btnTitle = titlesArray[i];
[btn setTitle:btnTitle forState:UIControlStateNormal];
btn.backgroundColor = UIColor.fus_appMainColor;
btn.layer.cornerRadius = BTN_HEIGHT / 2.0f;
btn.layer.masksToBounds = YES;
if (self.isPinkStyle) {
[btn setTitleColor:[UIColor colorWithHex:@"#FF668E"] forState:UIControlStateNormal];
} else {
[btn setTitleColor:[UIColor colorWithHex:@"#58DBD7"] forState:UIControlStateNormal];
}
[btn setTitleColor:[UIColor fus_textColorRich] forState:UIControlStateNormal];
[btn sizeToFit];
btn.tag = i+1;
......@@ -179,7 +167,10 @@ static FUSAlertView *sharedAlertView = nil;
CGFloat widthScale = [UIScreen mainScreen].bounds.size.width/375.0;
widthScale > 1.0 ? widthScale = 1.0 : widthScale; //6和6plus显示的一样
CGFloat alertViewW = ceil(270 * widthScale);
CGFloat alertViewW = ceil(280 * widthScale);
CGFloat btnX = 33;
CGFloat itemSpace = 13;
self.titleLabel.y = VIEW_MARGIN;
self.titleLabel.size = _titleStrSize;
......@@ -198,27 +189,30 @@ static FUSAlertView *sharedAlertView = nil;
aboveBtnFrame.size.height = 20;
self.noMoreTipBtn.frame = aboveBtnFrame;
} else {
if (self.detailLabel.height) {
aboveBtnFrame = self.detailLabel.frame;
} else {
aboveBtnFrame = self.titleLabel.frame;
}
}
UIView *separatorView = [[UIView alloc] initWithFrame:CGRectMake(12, CGRectGetMaxY(aboveBtnFrame) + DETAIL_BUTTON_SACE, alertViewW - 24, 0.5)];
separatorView.backgroundColor = [[UIColor colorWithHex:@"#FFFFFF"] colorWithAlphaComponent:0.09];
[self.bgView addSubview:separatorView];
[self.separatorArr addObject:separatorView];
// UIView *separatorView = [[UIView alloc] initWithFrame:CGRectMake(12, CGRectGetMaxY(aboveBtnFrame) + DETAIL_BUTTON_SACE, alertViewW - 24, 0.5)];
// separatorView.backgroundColor = [[UIColor colorWithHex:@"#FFFFFF"] colorWithAlphaComponent:0.09];
// [self.bgView addSubview:separatorView];
// [self.separatorArr addObject:separatorView];
// 只显示一行的情况
CGFloat btnWholeH = BTN_HEIGHT;
if ((self.confirmBtnArr.count == 1 || ([NSString isNull:self.cancelBtn.titleLabel.text]&&self.confirmBtnArr.count == 2))
&& _maxBtnWidth < alertViewW/2.0 - 10) {
CGFloat btnWholeW = alertViewW - 26;
CGFloat btnW = btnWholeW/2.0;
&& _maxBtnWidth < alertViewW/2.0) {
if (![NSString isNull:self.cancelBtn.titleLabel.text]) {
[self.confirmBtnArr insertObject:self.cancelBtn atIndex:0];
}
CGFloat btnX = 13;
CGFloat btnWholeW = alertViewW - btnX * 2 - itemSpace * (self.confirmBtnArr.count - 1);
CGFloat btnW = btnWholeW/2.0;
btnW = btnWholeW/self.confirmBtnArr.count;
for (int i = 0; i < self.confirmBtnArr.count; i++) {
......@@ -226,27 +220,26 @@ static FUSAlertView *sharedAlertView = nil;
btn.frame = CGRectMake(btnX, CGRectGetMaxY(aboveBtnFrame) + DETAIL_BUTTON_SACE, btnW, BTN_HEIGHT);
[self.bgView addSubview:btn];
btn.tag = i;
if (i < self.confirmBtnArr.count - 1) {
UIView *separatorCenterView = [[UIView alloc] init];
separatorCenterView.frame = CGRectMake(CGRectGetMaxX(btn.frame), btn.y, 0.5, btn.height);
separatorCenterView.backgroundColor = [[UIColor colorWithHex:@"#FFFFFF"] colorWithAlphaComponent:0.09];
[self.separatorArr addObject:separatorCenterView];
[self.bgView addSubview:separatorCenterView];
}
// if (i < self.confirmBtnArr.count - 1) {
// UIView *separatorCenterView = [[UIView alloc] init];
// separatorCenterView.frame = CGRectMake(CGRectGetMaxX(btn.frame), btn.y, 0.5, btn.height);
// separatorCenterView.backgroundColor = [[UIColor colorWithHex:@"#FFFFFF"] colorWithAlphaComponent:0.09];
// [self.separatorArr addObject:separatorCenterView];
// [self.bgView addSubview:separatorCenterView];
// }
btnX += btn.width;
btnX += btn.width + itemSpace;
}
// 按钮显示多行
}else{
CGFloat nextY = CGRectGetMaxY(aboveBtnFrame) + DETAIL_BUTTON_SACE;
CGFloat btnX = 13.0;
CGFloat btnW = alertViewW - 26;
CGFloat btnW = alertViewW - btnX * 2;
for (int i = 0;i < self.confirmBtnArr.count;i++) {
UIButton *btn = self.confirmBtnArr[i];
btn.frame = CGRectMake(btnX, nextY, btnW, BTN_HEIGHT);
nextY += BTN_HEIGHT;
nextY += (BTN_HEIGHT + itemSpace);
[self.bgView addSubview:btn];
CGFloat separatorCenterViewY = btn.y;
......@@ -257,10 +250,10 @@ static FUSAlertView *sharedAlertView = nil;
separatorCenterViewY = btn.y + btn.height;
}
UIView *separatorCenterView = [[UIView alloc] initWithFrame:CGRectMake(separatorView.x, separatorCenterViewY, btnW +2 , 0.5)];
separatorCenterView.backgroundColor = [[UIColor colorWithHex:@"#FFFFFF"] colorWithAlphaComponent:0.09];
[self.separatorArr addObject:separatorCenterView];
[self.bgView addSubview:separatorCenterView];
// UIView *separatorCenterView = [[UIView alloc] initWithFrame:CGRectMake(separatorView.x, separatorCenterViewY, btnW +2 , 0.5)];
// separatorCenterView.backgroundColor = [[UIColor colorWithHex:@"#FFFFFF"] colorWithAlphaComponent:0.09];
// [self.separatorArr addObject:separatorCenterView];
// [self.bgView addSubview:separatorCenterView];
}
if (_cancelBtn.titleLabel.text.length > 0) {
......@@ -268,11 +261,17 @@ static FUSAlertView *sharedAlertView = nil;
}else{
self.cancelBtn.frame = CGRectMake(btnX, nextY, btnW, 0);
}
btnWholeH = BTN_HEIGHT * self.confirmBtnArr.count + self.cancelBtn.height;
btnWholeH = BTN_HEIGHT * self.confirmBtnArr.count + itemSpace * (self.confirmBtnArr.count - 1) + self.cancelBtn.height;
}
self.bgView.width = alertViewW;
self.bgView.height = btnWholeH + self.titleLabel.height + self.detailLabel.height + VIEW_MARGIN + TITLE_DETAIL_SPACE + DETAIL_BUTTON_SACE + 10; //10为那张图片底部的阴影渐变范围
CGFloat bgHeight = VIEW_MARGIN + self.titleLabel.height;
if (self.detailLabel.height) {
bgHeight += (TITLE_DETAIL_SPACE + self.detailLabel.height);
}
bgHeight += (DETAIL_BUTTON_SACE + btnWholeH + VIEW_MARGIN);
self.bgView.height = bgHeight;
if (!self.noMoreTipBtn.isHidden) {
self.bgView.height += CGRectGetHeight(self.noMoreTipBtn.frame) + DETAIL_BUTTON_SACE;
}
......@@ -388,7 +387,7 @@ static FUSAlertView *sharedAlertView = nil;
_bgView.alpha = 0;
}];
self.cancelBtn = [UIButton buttonWithType:UIButtonTypeSystem];
[self fus_resetCancelBtn];
CGFloat widthScale = [UIScreen mainScreen].bounds.size.width/375.0;
widthScale > 1.0 ? widthScale = 1.0 :widthScale; //6和6plus显示的一样
......@@ -533,7 +532,7 @@ static FUSAlertView *sharedAlertView = nil;
[self fus_dismissAllAlertViewWithAnimate:NO];
self.cancelBtn = [UIButton buttonWithType:UIButtonTypeSystem];
[self fus_resetCancelBtn];
CGFloat widthScale = [UIScreen mainScreen].bounds.size.width/375.0;
widthScale > 1.0 ? widthScale = 1.0 : widthScale; //6和6plus显示的一样
......@@ -570,6 +569,21 @@ static FUSAlertView *sharedAlertView = nil;
}];
}
- (void)fus_resetCancelBtn {
if (!_cancelBtn) {
_cancelBtn = [UIButton buttonWithType:UIButtonTypeCustom];
}
_cancelBtn.titleLabel.font = [UIFont fus_themeMediumFont:14];
[_cancelBtn setTitleColor:[UIColor colorWithHex:@"333333"] forState:UIControlStateNormal];
[_cancelBtn addTarget:self action:@selector(onClickBtn:) forControlEvents:UIControlEventTouchUpInside];
_cancelBtn.backgroundColor = [UIColor colorWithHex:@"#DBDAD9"];
_cancelBtn.layer.cornerRadius = BTN_HEIGHT / 2.0f;
_cancelBtn.layer.masksToBounds = YES;
_cancelBtn.tag = 0;
[_bgView addSubview:_cancelBtn];
}
+ (void)fus_dismissAllAlertViewWithAnimate:(BOOL)animate{
[sharedAlertView fus_dismissAllAlertViewWithAnimate:animate];
......@@ -682,15 +696,15 @@ static FUSAlertView *sharedAlertView = nil;
_titleLabel.text = nil;
_titleLabel.attributedText = nil;
_titleLabel.textColor = [UIColor whiteColor];
_titleLabel.font = [UIFont systemFontOfSize:16 weight:UIFontWeightBold];
_titleLabel.textColor = UIColor.fus_textColorRich;
_titleLabel.font = [UIFont fus_themeBoldFont:19];
_titleLabel.textAlignment = NSTextAlignmentCenter;
_detailLabel.text = nil;
_detailLabel.attributedText = nil;
_detailLabel.textColor = [UIColor colorWithHex:@"#E6E6E6"];
_detailLabel.textColor = [UIColor colorWithHex:@"333333"];
_detailLabel.textAlignment = NSTextAlignmentCenter;
_detailLabel.font = [UIFont systemFontOfSize:13 weight:UIFontWeightRegular];
_detailLabel.font = [UIFont fus_themeFont:14];
}
@end
......@@ -687,9 +687,9 @@ static dispatch_queue_t get_status_queue() {
kLivePushConfigCodeModeKey:@"0",
kLivePushConfigFPSKey:@"18",
kLivePushConfigBeautyEnableKey:@"1",
kLivePushConfigMaxBitrateKey:@"1500",
kLivePushConfigMinBitrateKey:@"500",
kLivePushConfigTargetBitrateKey:@"1000",
kLivePushConfigMaxBitrateKey:@"4000",
kLivePushConfigMinBitrateKey:@"1000",
kLivePushConfigTargetBitrateKey:@"2000",
kLivePushConfigResolutionKey:@"2",
} forKey:LIVE_PUSH_CONFIG];
}
......
......@@ -5,12 +5,12 @@
"scale" : "1x"
},
{
"filename" : "live_room_card_invite_mic_btn@2x.png",
"filename" : "上麦@2x.png",
"idiom" : "universal",
"scale" : "2x"
},
{
"filename" : "live_room_card_invite_mic_btn@3x.png",
"filename" : "上麦@3x.png",
"idiom" : "universal",
"scale" : "3x"
}
......
......@@ -5,12 +5,12 @@
"scale" : "1x"
},
{
"filename" : "live_room_card_invite_mic_btn_pressed@2x.png",
"filename" : "上麦@2x.png",
"idiom" : "universal",
"scale" : "2x"
},
{
"filename" : "live_room_card_invite_mic_btn_pressed@3x.png",
"filename" : "上麦@3x.png",
"idiom" : "universal",
"scale" : "3x"
}
......
......@@ -396,6 +396,8 @@ if (@available(iOS 11.0, *)) {height = 80 + UIView.fus_SafeBottom;}\
_richImageView.centerX = _faceImageView.centerX;
_richImageView.centerY = _faceImageView.bottom;
// _richWearImageView.center = _faceImageView.center;
[_bgView addRoundedCorners:UIRectCornerTopLeft|UIRectCornerTopRight withRadii:CGSizeMake(16, 16)];
}
- (void)fus_initBgView {
......@@ -775,7 +777,7 @@ if (@available(iOS 11.0, *)) {height = 80 + UIView.fus_SafeBottom;}\
- (void)pd_setupRoomControlView {
_roomControlView = [[UIView alloc] initWithFrame:CGRectMake(0, _buttomBtnBgView.bottom, _bgView.width, ROOM_CONTROL_VIEW_HEIGHT())];
_roomControlView.backgroundColor = [UIColor colorWithHex:@"#242A36"];
_roomControlView.backgroundColor = [UIColor colorWithHex:@"#F1F0F0"];
[_bgView addSubview:_roomControlView];
CGFloat bottonHeight = _roomControlView.height;
if (@available(iOS 11.0, *)) {
......
......@@ -50,9 +50,6 @@
@end
@implementation FUSByteStreamCaptureHelper
{
long long captureTimeCount;
}
#pragma mark - Init
......@@ -295,6 +292,10 @@
{
videoSize = CGSizeMake(720, 1280);
}
case 4:// 1080P
{
videoSize = CGSizeMake(1080, 1920);
}
break;
default:// 默认 540
videoSize = CGSizeMake(540, 960);
......@@ -341,9 +342,9 @@
// 视频帧率
_liveConfig.videoFPS = fps;
// 视频码率
_liveConfig.bitrate = targetBitrate;
_liveConfig.minBitrate = minBitrate;
_liveConfig.maxBitrate = maxBitrate;
_liveConfig.bitrate = targetBitrate * 1000;;
_liveConfig.minBitrate = minBitrate * 1000;;
_liveConfig.maxBitrate = maxBitrate * 1000;;
_liveConfig.outputSize = videoSize;
......@@ -427,13 +428,10 @@
if (![FUSBeautyHelper shareInstance].beautyEngineEnable) {
// 没有美颜正在运行或者当前开关处于关闭状态
// 声网采集协议正在运行
if (self.agoraVideoSourceRuning) {
captureTimeCount += 1;
// 声网采集协议正在运行
if (self.videoFrameCallBackHandler) {
self.videoFrameCallBackHandler(buffer, pts, 0);
}
}
[_capture pushVideoBuffer:buffer andCMTime:pts];
return;
......@@ -441,18 +439,11 @@
CVPixelBufferRef targetPixelBuffer = [[FUSBeautyHelper shareInstance] renderBeautyWithPixelBuffer:buffer timeStamp:(pts.value / pts.timescale)];
// 声网采集协议正在运行
if (self.agoraVideoSourceRuning) {
captureTimeCount++;
//CMTimeMake(captureTimeCount, 600)
// 声网采集协议正在运行
if (self.videoFrameCallBackHandler) {
self.videoFrameCallBackHandler(buffer, pts, 0);
}
}
[_capture pushVideoBuffer:targetPixelBuffer andCMTime:pts];
}
......@@ -542,8 +533,6 @@
/**
重新开始推理,不停止原来的推流
@param completion 完成回调
*/
- (void)fus_reloadPush
{
......
......@@ -57,9 +57,6 @@ typedef NS_ENUM(NSInteger, FUSStreamSessionState)
CMTime pts,
int rotation);
// 声网自定义视频源是否正在运行中
@property (nonatomic, assign) BOOL agoraVideoSourceRuning;
+ (FUSStreamCaptureHelper *)fus_captureHepler;
#pragma mark - Public Method
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment