简体   繁体   中英

Touch issue during UIView Animation

I am animating UIView when user touches on custom dropdown to show picker View from bottom side.UIView contains Pickerview...so when I change it's frame to move upwards.I get what I want, but pickerView doesn't recognize touch !(see screenshot below)

code is like this

    CGRect pickerFrame=self.pickerSheet.frame;
    CGRect viewFrame=self.view.frame;

[UIView beginAnimations:nil context:NULL];
[UIView setAnimationDuration:SHEET_ANIMATION_DURATION];
//change Frame of View containing UIPickerView

pickerFrame.origin.y=202+animatedDistance;
viewFrame.origin.y-=animatedDistance;//animated distance is value by which view needs to move upward.
[self.pickerSheet setFrame:pickerFrame];
[self.view setFrame:viewFrame];

[UIView commitAnimations]; 

screenshot

Please start using the new , better animation block , but I think there is something missing in your code , you need to put the code below :

UIViewAnimationOptionAllowUserInteraction

Put this code in options in the new animation block , or find a way to put it in the old animation block

first of all, ++please**, stop using this animation declaration, and bedin use new, block animation:

[UIView animateWithDuration:SHEET_ANIMATION_DURATION 
                          delay:0 
                        options:nil 
                     animations:^{
                         pickerFrame.origin.y=202+animatedDistance;
                         viewFrame.origin.y-=animatedDistance;
                     } 
                     completion:^(BOO f){
                         //any actions after animation ended
                     }];

Second, I think your problem is somewhere else. May by, you implementing your touches or picker wrong.

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