N.nnd N.nnd - 3 months ago 7
iOS Question

Why my view can not recognize the UIPanGestureRecognizer?

When I tag the image, there is no things to show? Why?

enter image description here

enter image description here

Answer
- (void)viewDidLoad {
    [super viewDidLoad];

    _view2 = [[V0 alloc ]initWithFrame:self.view.bounds];
    CGRect a = self.view2.frame;
    a.origin.x = 100;
    a.origin.y = 150;
    _view2.frame = a;
    _view2.userInteractionEnabled = YES;

    [self.view2 addGestureRecognizer:[[UIPanGestureRecognizer alloc]initWithTarget:self.view2 action:@selector(Up:)]];

i add the initWithFrame ,then my view can recognize my gesture