I have some side UIView
that is in the screen size .
This side UIView
, is placed on the left where its X
is at -screen.width
, so we dont see him .
Than , in this side view class view, i am adding a small square UIView, at its right , at screen.width
, that means on the main view i can see on the left , this little square from the side view .
This structure is to get a side menu effect .
In this little square view, there is a UIButton
, but this button is not responding to touches .
I do not want to place this side menu where it is a few pixels inside the screen, because this may cover some content .
Hence, i created this structure where the side menu is in the screen size,it is placed on minus screen size.width
and has this little square that comes into the screen ,and when you push it, the whole side view comes in .
Why is this button is disabled ? is that because he is hang in the air, where part of it is not inside its superview ?
EDIT:
Found this great answer which is not working for me
interaction beyond bounds of uiview
I have added this to the parent view that contains the button , and it does log the touch,but not working.
- (UIView *)hitTest:(CGPoint)point withEvent:(UIEvent *)event
{
CGFloat radius = 200.0;
CGRect frame = CGRectMake(self.frame.size.width, 0,
radius,
radius);
if (CGRectContainsPoint(frame, point))
{
NSLog(@"log");
return self;
}
return nil;
}
- (BOOL)pointInside:(CGPoint)point withEvent:(UIEvent *)event
{
if (CGRectContainsPoint(self.bounds, point) ||
CGRectContainsPoint(menus.frame, point))
{
return YES;
}
return NO;
}