I have a UIViewController . Inside this is a UITableView , which is drawn at the beginning of 0,0 . I also have a UIScrollView that draws at 0,-80 , so that it is turned off and not showing.
When the menu button is pressed, I am animating a UIViewController from below 80px to show a UIScrollView .
The problem here is that the UIScrollView not responding at all.
If I draw a UIScrollView , say 0,0 , where it displays when loading, it works fine. I can even revive it from the screen, and then return to the screen without any problems.
Here's what my gaze looks like before the animation:
_____________________________ | | Frame -> (0,-80, 320, 80) | ScrollView | **Offscreen** |_____________________________| | | <- Original view (0,0,320,480) | | | | | | | | | | | Original View | | | | | | | | | | | | | | | | | | | | | |_____________________________|
When I live, I do the following:
[UIView animateWithDuration:0.3 delay:0.0 options:(UIViewAnimationOptionAllowUserInteraction | UIViewAnimationOptionCurveEaseIn) animations:^{ self.view.frame = CGRectMake(0.0, (self.view.frame.origin.y + container.frame.size.height), self.view.frame.size.width, self.view.frame.size.height); scroll.userInteractionEnabled = YES; } completion:^(BOOL finished) { if (scrollLoaded == NO) { [self loadFavorites]; scrollLoaded = YES; } }];
Now my view looks after the animation:
_____________________________ | | Frame -> (0, -80, 320, 80) | ScrollView | |_____________________________| | | <- Original view (0, 80, 320, 480) | | | | | | | | | | | Original View | | | | | | | | | | | | | | | |_____________________________| | | | **Offscreen** | |_____________________________|
I have subclassed my scrollView to listen more closely to events:
.h
wow
#import "UIScrollView+ExtraTouch.h" @implementation UIScrollView_ExtraTouch - (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event{ NSLog(@"scrollview touchesBegan"); [self.nextResponder touchesBegan:touches withEvent:event]; } - (void)touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event{ NSLog(@"scrollview touchesMoved"); if(!self.dragging){ [self.nextResponder touchesMoved:touches withEvent:event]; } } - (void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event{ NSLog(@"scrollview touchesEnded"); [self.nextResponder touchesEnded:touches withEvent:event]; } @end
Nothing goes to the magazine after the animation. I think this means that since the frame is at -80 , it believes that it is off, so it does not receive any action.
It is right? If so, can this be fixed?