简体   繁体   中英

UIPanGestureRecognizer is working for only uiview not for uiimageview

Can anyone give me the exact reason why the UIPanGestureRecognizer in not working for UIImageView and working for UIView I didnt find any blog. Below is my code(working now)

UIView *endImage=[[UIView alloc]init];

    endImage.backgroundColor=[[UIColor yellowColor] colorWithAlphaComponent:0.3f];
    UIPanGestureRecognizer *panOnEndImage = [[UIPanGestureRecognizer alloc] initWithTarget:self action:@selector(handlePanOnLine:)];

    panOnEndImage.delegate=self;
    [endImage addGestureRecognizer:panOnEndImage];
    [anotherUIView addSubview:endImage];
    [panOnEndImage release];

if i am changing endimage as a UIIMageView object then that panning is not working...Thanks in advance your suggestion is more important.

Please add this line and try. [endImage setUserInteractionEnabled:YES]; so this is the answer.(right ;)!

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM