Closed jlr closed 11 years ago
That's because the MCPanelViewController's view itself is consuming the touches. This view is transparent and completely covers the parent view controller (presenting view controller) and your presented view controller's view is then added as a subview to it.
One possible solution is replace this view with a subclass that overwrites the - (BOOL)pointInside:(CGPoint)point withEvent:(UIEvent *)event
method to allow touches not inside the view of the presented view controller (rootViewController property) to pass through.
Thanks very much. That did it.
Hi, I tried to implement this solution in your example but I did not succeed. Can you help me? Thank you in advance
Can you elaborate how you have implemented the solution?
Hi Matthewcheok,
Thanks for your answer :) I am a beginner in iOS programming. I certainly made mistakes. Here is my implementation: I created a subclass of UIView class: @interface MCCustomView : UIView with:
In the initWithRootViewController method of MCPanelViewController, I added: object_setClass(self.view, [MCCustomView class]);
I also tried to change the frame properties and bounds of the view without success.
PS : sorry for my english!
Small addition:
I deleted also all references to: shadowView, imageView & backgroundButton
You can overwrite - (void)loadView
and specify self.view = [[MCCustomView alloc] init]
to specify the class to be used for the view controller.
The result is the same as my implementation. The pointInside's method is called (twice) but the buttons called "Left" and "Push view controller" remain inactive :( Should i resize the frame of the MCPanelViewController's view ?
Here's an implementation for MCCustomView
:
- (UIView *)hitTest:(CGPoint)point withEvent:(UIEvent *)event {
UIView *view = [super hitTest:point withEvent:event];
return view == self ? nil : view;
}
This essentially means that areas within the view that do not contain subviews will be regarded as not 'inside' of the view, and will pass touches to whatever is behind (like your buttons).
Thank you ! It Works! One more thing if it is possible : What changes should I make to MCPanelViewController class for :
Thank you for your job and your help !
Hi,
Thanks for the excellent slideout widget. It's a really huge boost to the app I'm building and I'm very grateful that you've released it.
I have been studying your code for over a week now (I think I found it the day it was released - Oct 5?). I can't seem to figure out something that ought to be trivial. I want slideouts to only obscure the portion of the screen which they actually cover, so that you can still tap any other part of the screen and interact with it normally.
I've disabled the backgroundButton property and the shadow that appears over the remainder of the screen when you slide out, and also looked in detail at various CGRect and CGBounds properties to see if I'm missing any views that cover the whole screen. But I'm just not seeing what's preventing tap gestures to go through when a MCPanelView is slid out.
Could you give me some form of pointer towards solving this? It would be extremely helpful to me.
Thanks again for releasing such high quality and beautiful code. This slideout widget makes a big difference for me.