Closed hsavit1 closed 9 years ago
Hi.
I'd need more info to evaluate your issue. Are you using DRPageScrollView? If so, did you enable page reuse?
Hey @hsavit1 did you finally get around with this issue?
Yea I never figured it out actually.
The Button loses its functionality on the second and third pages of the view pager. Will keep you posted if I come up with something
On Monday, June 8, 2015, David Román notifications@github.com wrote:
Hey @hsavit1 https://github.com/hsavit1 did you finally get around with this issue?
— Reply to this email directly or view it on GitHub https://github.com/Dromaguirre/Popsicle/issues/13#issuecomment-109955630 .
Sent from Gmail Mobile
@hsavit1
Oh my. I just came up with what that's about. Since the page view where the button is contained is out of bounds but the button is still visible, it won't receive touch events. It's a default behavior every UIView component has: they ignore touch events when they're out of bounds from their parent superviews.
Check out this official document from Apple where they explain how to get around it: https://developer.apple.com/library/ios/qa/qa2013/qa1812.html
If for some reasons the existing layout has to be maintained, you can change the hit-testing behavior of the parent view so that it doesn't ignore the touch events. This can be done by overriding the -(UIView *)hitTest:withEvent: method of the parent view's class.
- (UIView *)hitTest:(CGPoint)point withEvent:(UIEvent *)event {
// Convert the point to the target view's coordinate system.
// The target view isn't necessarily the immediate subview
CGPoint pointForTargetView = [self.targetView convertPoint:point fromView:self];
if (CGRectContainsPoint(self.targetView.bounds, pointForTargetView)) {
// The target view may have its view hierarchy,
// so call its hitTest method to return the right hit-test view
return [self.targetView hitTest:pointForTargetView withEvent:event];
}
return [super hitTest:point withEvent:event];
}
hey, forgot to respond to this
looks neat! will check out
hey,
I have a button that I anchor to a corner on the first page, and it stays static across 3 separate page views. The button gets anchored fantastically, however it removes itself as a target in the second and third pages. Any idea as to how I can keep it as a functional button?
Thanks!