最后调整
This commit is contained in:
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user