最后调整
This commit is contained in:
@@ -107,6 +107,11 @@ static NSInteger toSlowCount = 4;
|
||||
self.bgView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, SCREEN_WIDTH, ScaleWidth(663))];
|
||||
[self.bgView addRoundedCornersWithRadius:16 byRoundingCorners:(UIRectCornerTopLeft|UIRectCornerTopRight)];
|
||||
[self addSubview:self.bgView];
|
||||
// 添加拖拽手势
|
||||
UIPanGestureRecognizer *panGesture = [[UIPanGestureRecognizer alloc]
|
||||
initWithTarget:self
|
||||
action:@selector(handlePanGesture:)];
|
||||
[self.bgView addGestureRecognizer:panGesture];
|
||||
|
||||
self.bgImageView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"active_sky_raize_bg"]];
|
||||
self.bgImageView.frame = CGRectMake(0, 0, SCREEN_WIDTH, ScaleWidth(663));
|
||||
@@ -266,7 +271,43 @@ static NSInteger toSlowCount = 4;
|
||||
self.centerView.activityType = QXActivityTypeSky;
|
||||
[self.bgView addSubview:self.centerView];
|
||||
}
|
||||
|
||||
- (void)handlePanGesture:(UIPanGestureRecognizer *)gesture {
|
||||
static CGPoint originalCenter;
|
||||
|
||||
if (gesture.state == UIGestureRecognizerStateBegan) {
|
||||
// 记录原始中心点
|
||||
originalCenter = gesture.view.center;
|
||||
}else if (gesture.state == UIGestureRecognizerStateChanged) {
|
||||
// 获取拖拽位移
|
||||
CGPoint translation = [gesture translationInView:self];
|
||||
|
||||
// 只允许向下拖拽
|
||||
if (translation.y > 0) {
|
||||
gesture.view.center = CGPointMake(originalCenter.x, originalCenter.y + translation.y);
|
||||
|
||||
// // 根据拖拽距离调整透明度
|
||||
// CGFloat progress = translation.y / (self.view.bounds.size.height / 2);
|
||||
// gesture.view.alpha = 1.0 - MIN(progress, 0.8);
|
||||
}
|
||||
}
|
||||
else if (gesture.state == UIGestureRecognizerStateEnded ||
|
||||
gesture.state == UIGestureRecognizerStateCancelled) {
|
||||
|
||||
CGPoint translation = [gesture translationInView:self];
|
||||
CGPoint velocity = [gesture velocityInView:self];
|
||||
// 判断是否应该消失:拖拽超过一半高度或速度足够快
|
||||
BOOL shouldDismiss = translation.y > self.bgView.height/2.0 || velocity.y > 1000;
|
||||
|
||||
if (shouldDismiss) {
|
||||
[self hide];
|
||||
} else {
|
||||
// 恢复原位置
|
||||
[UIView animateWithDuration:0.3 animations:^{
|
||||
self.bgView.y = SCREEN_HEIGHT-ScaleWidth(663);
|
||||
}];
|
||||
}
|
||||
}
|
||||
}
|
||||
-(void)getMyWallet{
|
||||
MJWeakSelf
|
||||
[[QXRequset shareInstance] getWithUrl:QXWallet parameters:@{@"token":[QXGlobal shareGlobal].loginModel.token?[QXGlobal shareGlobal].loginModel.token:@""} needCache:NO success:^(id responseObject) {
|
||||
|
||||
@@ -108,6 +108,11 @@ static NSInteger toSlowCount = 4;
|
||||
self.bgView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, SCREEN_WIDTH, ScaleWidth(663))];
|
||||
[self.bgView addRoundedCornersWithRadius:16 byRoundingCorners:(UIRectCornerTopLeft|UIRectCornerTopRight)];
|
||||
[self addSubview:self.bgView];
|
||||
// 添加拖拽手势
|
||||
UIPanGestureRecognizer *panGesture = [[UIPanGestureRecognizer alloc]
|
||||
initWithTarget:self
|
||||
action:@selector(handlePanGesture:)];
|
||||
[self.bgView addGestureRecognizer:panGesture];
|
||||
|
||||
self.bgImageView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"active_age_castle_bg"]];
|
||||
self.bgImageView.frame = CGRectMake(0, 0, SCREEN_WIDTH, ScaleWidth(663));
|
||||
@@ -299,7 +304,43 @@ static NSInteger toSlowCount = 4;
|
||||
[self.bgView addSubview:self.centerView];
|
||||
|
||||
}
|
||||
|
||||
- (void)handlePanGesture:(UIPanGestureRecognizer *)gesture {
|
||||
static CGPoint originalCenter;
|
||||
|
||||
if (gesture.state == UIGestureRecognizerStateBegan) {
|
||||
// 记录原始中心点
|
||||
originalCenter = gesture.view.center;
|
||||
}else if (gesture.state == UIGestureRecognizerStateChanged) {
|
||||
// 获取拖拽位移
|
||||
CGPoint translation = [gesture translationInView:self];
|
||||
|
||||
// 只允许向下拖拽
|
||||
if (translation.y > 0) {
|
||||
gesture.view.center = CGPointMake(originalCenter.x, originalCenter.y + translation.y);
|
||||
|
||||
// // 根据拖拽距离调整透明度
|
||||
// CGFloat progress = translation.y / (self.view.bounds.size.height / 2);
|
||||
// gesture.view.alpha = 1.0 - MIN(progress, 0.8);
|
||||
}
|
||||
}
|
||||
else if (gesture.state == UIGestureRecognizerStateEnded ||
|
||||
gesture.state == UIGestureRecognizerStateCancelled) {
|
||||
|
||||
CGPoint translation = [gesture translationInView:self];
|
||||
CGPoint velocity = [gesture velocityInView:self];
|
||||
// 判断是否应该消失:拖拽超过一半高度或速度足够快
|
||||
BOOL shouldDismiss = translation.y > self.bgView.height/2.0 || velocity.y > 1000;
|
||||
|
||||
if (shouldDismiss) {
|
||||
[self hide];
|
||||
} else {
|
||||
// 恢复原位置
|
||||
[UIView animateWithDuration:0.3 animations:^{
|
||||
self.bgView.y = SCREEN_HEIGHT-ScaleWidth(663);
|
||||
}];
|
||||
}
|
||||
}
|
||||
}
|
||||
-(void)getMyWallet{
|
||||
MJWeakSelf
|
||||
[[QXRequset shareInstance] getWithUrl:QXWallet parameters:@{@"token":[QXGlobal shareGlobal].loginModel.token?[QXGlobal shareGlobal].loginModel.token:@""} needCache:NO success:^(id responseObject) {
|
||||
|
||||
@@ -9,7 +9,14 @@
|
||||
#import "QXTimer.h"
|
||||
#import "GKCycleScrollView.h"
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
typedef NS_ENUM(NSInteger) {
|
||||
/// 抽一次
|
||||
QXMeetDrawBtnTypeOne = 1,
|
||||
/// 抽10次
|
||||
QXMeetDrawBtnTypeTen = 10,
|
||||
/// 抽100次
|
||||
QXMeetDrawBtnTypeHundred = 100,
|
||||
}QXMeetDrawBtnType;
|
||||
@interface QXMeetActivityView : UIView
|
||||
-(void)showInView:(UIView *)view;
|
||||
@property (nonatomic,strong)NSString *roomId;
|
||||
@@ -43,7 +50,7 @@ NS_ASSUME_NONNULL_BEGIN
|
||||
@property (nonatomic,strong)UILabel *titleLabel;
|
||||
@property (nonatomic,strong)UIButton *giftCoin;
|
||||
@property (nonatomic,assign)BOOL isDisable;
|
||||
@property (nonatomic,assign)QXSkyDrawBtnType btnType;
|
||||
@property (nonatomic,assign)QXMeetDrawBtnType btnType;
|
||||
@end
|
||||
|
||||
|
||||
|
||||
@@ -101,7 +101,11 @@
|
||||
self.bgView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, SCREEN_WIDTH, ScaleWidth(663))];
|
||||
[self.bgView addRoundedCornersWithRadius:16 byRoundingCorners:(UIRectCornerTopLeft|UIRectCornerTopRight)];
|
||||
[self addSubview:self.bgView];
|
||||
|
||||
// 添加拖拽手势
|
||||
UIPanGestureRecognizer *panGesture = [[UIPanGestureRecognizer alloc]
|
||||
initWithTarget:self
|
||||
action:@selector(handlePanGesture:)];
|
||||
[self.bgView addGestureRecognizer:panGesture];
|
||||
// NSString *path = [[NSBundle mainBundle] pathForResource:@"ac_meet_big_bg@2x" ofType:@"png"];
|
||||
// UIImage *bgImage = [UIImage imageWithContentsOfFile:path];
|
||||
self.bgImageView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"ac_meet_big_bg"]];
|
||||
@@ -223,21 +227,21 @@
|
||||
CGFloat btnWidth = ScaleWidth(109);
|
||||
CGFloat btnMargin = (SCREEN_WIDTH- ScaleWidth(109)*3)/4;
|
||||
QXMeetDrawBtn *oneBtn = [[QXMeetDrawBtn alloc] initWithFrame:CGRectMake(btnMargin, self.bgView.height-ScaleWidth(34)-20, btnWidth, ScaleWidth(34))];
|
||||
oneBtn.btnType = QXSkyDrawBtnTypeOne;
|
||||
oneBtn.btnType = QXMeetDrawBtnTypeOne;
|
||||
self.oneBtn = oneBtn;
|
||||
self.oneBtn.hidden = YES;
|
||||
[oneBtn addTarget:self action:@selector(startAction:) forControlEvents:(UIControlEventTouchUpInside)];
|
||||
[self.bgView addSubview:oneBtn];
|
||||
|
||||
QXMeetDrawBtn *tenBtn = [[QXMeetDrawBtn alloc] initWithFrame:CGRectMake(self.oneBtn.right+btnMargin, self.oneBtn.top, btnWidth, ScaleWidth(34))];
|
||||
tenBtn.btnType = QXSkyDrawBtnTypeTen;
|
||||
tenBtn.btnType = QXMeetDrawBtnTypeTen;
|
||||
self.tenBtn = tenBtn;
|
||||
self.tenBtn.hidden = YES;
|
||||
[tenBtn addTarget:self action:@selector(startAction:) forControlEvents:(UIControlEventTouchUpInside)];
|
||||
[self.bgView addSubview:tenBtn];
|
||||
|
||||
QXMeetDrawBtn *hundredBtn = [[QXMeetDrawBtn alloc] initWithFrame:CGRectMake(tenBtn.right+btnMargin, self.oneBtn.top, btnWidth, ScaleWidth(34))];
|
||||
hundredBtn.btnType = QXSkyDrawBtnTypeHundred;
|
||||
hundredBtn.btnType = QXMeetDrawBtnTypeHundred;
|
||||
self.hundredBtn = hundredBtn;
|
||||
self.hundredBtn.hidden = YES;
|
||||
[hundredBtn addTarget:self action:@selector(startAction:) forControlEvents:(UIControlEventTouchUpInside)];
|
||||
@@ -284,6 +288,43 @@
|
||||
self.drawGiftCenterBgImageView.frame = CGRectMake((self.bgView.width-ScaleWidth(105))/2, self.cycleScrollView.top+25, ScaleWidth(105), ScaleWidth(105));
|
||||
[self.bgView addSubview:self.drawGiftCenterBgImageView];
|
||||
}
|
||||
- (void)handlePanGesture:(UIPanGestureRecognizer *)gesture {
|
||||
static CGPoint originalCenter;
|
||||
|
||||
if (gesture.state == UIGestureRecognizerStateBegan) {
|
||||
// 记录原始中心点
|
||||
originalCenter = gesture.view.center;
|
||||
}else if (gesture.state == UIGestureRecognizerStateChanged) {
|
||||
// 获取拖拽位移
|
||||
CGPoint translation = [gesture translationInView:self];
|
||||
|
||||
// 只允许向下拖拽
|
||||
if (translation.y > 0) {
|
||||
gesture.view.center = CGPointMake(originalCenter.x, originalCenter.y + translation.y);
|
||||
|
||||
// // 根据拖拽距离调整透明度
|
||||
// CGFloat progress = translation.y / (self.view.bounds.size.height / 2);
|
||||
// gesture.view.alpha = 1.0 - MIN(progress, 0.8);
|
||||
}
|
||||
}
|
||||
else if (gesture.state == UIGestureRecognizerStateEnded ||
|
||||
gesture.state == UIGestureRecognizerStateCancelled) {
|
||||
|
||||
CGPoint translation = [gesture translationInView:self];
|
||||
CGPoint velocity = [gesture velocityInView:self];
|
||||
// 判断是否应该消失:拖拽超过一半高度或速度足够快
|
||||
BOOL shouldDismiss = translation.y > self.bgView.height/2.0 || velocity.y > 1000;
|
||||
|
||||
if (shouldDismiss) {
|
||||
[self hide];
|
||||
} else {
|
||||
// 恢复原位置
|
||||
[UIView animateWithDuration:0.3 animations:^{
|
||||
self.bgView.y = SCREEN_HEIGHT-ScaleWidth(663);
|
||||
}];
|
||||
}
|
||||
}
|
||||
}
|
||||
-(BOOL)gestureRecognizer:(UIGestureRecognizer *)gestureRecognizer shouldReceiveTouch:(UITouch *)touch{
|
||||
return touch.view == self;
|
||||
}
|
||||
@@ -730,7 +771,7 @@
|
||||
_isDisable = isDisable;
|
||||
self.bgImageView.image = [UIImage imageNamed:isDisable?@"meet_touch_dis_bg":@"meet_touch_bg"];
|
||||
}
|
||||
-(void)setBtnType:(QXSkyDrawBtnType)btnType{
|
||||
-(void)setBtnType:(QXMeetDrawBtnType)btnType{
|
||||
// /// 抽一次
|
||||
// QXSkyDrawBtnTypeOne = 0,
|
||||
// /// 抽10次
|
||||
@@ -739,19 +780,19 @@
|
||||
// QXSkyDrawBtnTypeHundred ,
|
||||
_btnType = btnType;
|
||||
switch (btnType) {
|
||||
case QXSkyDrawBtnTypeOne:
|
||||
case QXMeetDrawBtnTypeOne:
|
||||
{
|
||||
self.titleLabel.text = @"抽一次";
|
||||
[self.giftCoin setTitle:@"10币一次" forState:(UIControlStateNormal)];
|
||||
}
|
||||
break;
|
||||
case QXSkyDrawBtnTypeTen:
|
||||
case QXMeetDrawBtnTypeTen:
|
||||
{
|
||||
self.titleLabel.text = @"抽十次";
|
||||
[self.giftCoin setTitle:@"100币一次" forState:(UIControlStateNormal)];
|
||||
}
|
||||
break;
|
||||
case QXSkyDrawBtnTypeHundred:
|
||||
case QXMeetDrawBtnTypeHundred:
|
||||
{
|
||||
self.titleLabel.text = @"抽百次";
|
||||
[self.giftCoin setTitle:@"1000币一次" forState:(UIControlStateNormal)];
|
||||
|
||||
@@ -114,6 +114,12 @@ static NSInteger toSlowCount = 4;
|
||||
self.bgImageView.contentMode = UIViewContentModeScaleToFill;
|
||||
[self.bgView addSubview:self.bgImageView];
|
||||
|
||||
// 添加拖拽手势
|
||||
UIPanGestureRecognizer *panGesture = [[UIPanGestureRecognizer alloc]
|
||||
initWithTarget:self
|
||||
action:@selector(handlePanGesture:)];
|
||||
[self.bgView addGestureRecognizer:panGesture];
|
||||
|
||||
self.poolBtn = [[UIButton alloc] initWithFrame:CGRectMake(0, ScaleWidth(48), ScaleWidth(48), ScaleWidth(24))];
|
||||
[self.poolBtn setBackgroundImage:[UIImage imageNamed:@"time_right_bg"] forState:(UIControlStateNormal)];
|
||||
[self.poolBtn setTitle:@"奖池" forState:(UIControlStateNormal)];
|
||||
@@ -299,7 +305,43 @@ static NSInteger toSlowCount = 4;
|
||||
[self.bgView addSubview:self.centerView];
|
||||
|
||||
}
|
||||
|
||||
- (void)handlePanGesture:(UIPanGestureRecognizer *)gesture {
|
||||
static CGPoint originalCenter;
|
||||
|
||||
if (gesture.state == UIGestureRecognizerStateBegan) {
|
||||
// 记录原始中心点
|
||||
originalCenter = gesture.view.center;
|
||||
}else if (gesture.state == UIGestureRecognizerStateChanged) {
|
||||
// 获取拖拽位移
|
||||
CGPoint translation = [gesture translationInView:self];
|
||||
|
||||
// 只允许向下拖拽
|
||||
if (translation.y > 0) {
|
||||
gesture.view.center = CGPointMake(originalCenter.x, originalCenter.y + translation.y);
|
||||
|
||||
// // 根据拖拽距离调整透明度
|
||||
// CGFloat progress = translation.y / (self.view.bounds.size.height / 2);
|
||||
// gesture.view.alpha = 1.0 - MIN(progress, 0.8);
|
||||
}
|
||||
}
|
||||
else if (gesture.state == UIGestureRecognizerStateEnded ||
|
||||
gesture.state == UIGestureRecognizerStateCancelled) {
|
||||
|
||||
CGPoint translation = [gesture translationInView:self];
|
||||
CGPoint velocity = [gesture velocityInView:self];
|
||||
// 判断是否应该消失:拖拽超过一半高度或速度足够快
|
||||
BOOL shouldDismiss = translation.y > self.bgView.height/2.0 || velocity.y > 1000;
|
||||
|
||||
if (shouldDismiss) {
|
||||
[self hide];
|
||||
} else {
|
||||
// 恢复原位置
|
||||
[UIView animateWithDuration:0.3 animations:^{
|
||||
self.bgView.y = SCREEN_HEIGHT-ScaleWidth(663);
|
||||
}];
|
||||
}
|
||||
}
|
||||
}
|
||||
-(void)getMyWallet{
|
||||
MJWeakSelf
|
||||
[[QXRequset shareInstance] getWithUrl:QXWallet parameters:@{@"token":[QXGlobal shareGlobal].loginModel.token?[QXGlobal shareGlobal].loginModel.token:@""} needCache:NO success:^(id responseObject) {
|
||||
|
||||
Reference in New Issue
Block a user