Files
yuyin_ios/SweetParty/主类/音悦新增/盲盒巡乐会/BlindXunlehuiShowView.m

48 lines
1.3 KiB
Mathematica
Raw Normal View History

2025-08-08 11:05:33 +08:00
//
// BlindXunlehuiShowView.m
// SweetParty
//
// Created by yons on 2024/12/28.
//
#import "BlindXunlehuiShowView.h"
@interface BlindXunlehuiShowView ()
@property (nonatomic, assign)CGPoint originalPoint;
@end
@implementation BlindXunlehuiShowView
- (void)awakeFromNib {
[super awakeFromNib];
[_leftTimeL styleGradiBlueColor];
UIPanGestureRecognizer *pan = [[UIPanGestureRecognizer alloc] initWithTarget:self action:@selector(onTuodong:)];
[self addGestureRecognizer:pan];
}
- (IBAction)onClose:(id)sender {
[self removeFromSuperview];
}
//
- (void)onTuodong:(UIPanGestureRecognizer *)pan{
//
CGPoint currentPosition = [pan locationInView:self];
if (pan.state == UIGestureRecognizerStateBegan) {
_originalPoint = currentPosition;
}else if(pan.state == UIGestureRecognizerStateChanged){
//( - = )
CGFloat offsetX = currentPosition.x - _originalPoint.x;
CGFloat offsetY = currentPosition.y - _originalPoint.y;
//
CGFloat centerX = self.center.x + offsetX;
CGFloat centerY = self.center.y + offsetY;
self.center = CGPointMake(centerX, centerY);
}
}
@end