nverinaud / NVSlideMenuController

A slide menu done right for iOS.
MIT License
175 stars 33 forks source link

Should not be able to interact with content view when menu is active #27

Closed ajsharp closed 8 years ago

ajsharp commented 10 years ago

If you have a table view as the content controller, and the menu is show, you can still interact with the menu. Here's a screenshot for clarity: https://www.dropbox.com/s/eeyz3lu7c6tsjes/Screenshot%202014-01-11%2016.47.45.png

nverinaud commented 10 years ago

I would implement viewDidSlideOut:inSlideMenuController: in your content view controller and disable userInteraction with the table view. If it's a UITableViewController subclass, I would suggest you to subclass UIViewController instead and do the table view stuff by hand because the tap gesture is attached to the contentViewController's view and will not recognized if user interaction is disabled.

shto commented 10 years ago

@nverinaud But in the case we would disable user interactions for the contentViewController's view, it won't react to any further actions, not panning or tapping, so we can not bring the view controller back. Or am I using the setUserInteractionsEnabled on the wrong view?

The way I've implemented this, it by putting a low-alpha overlay button on top of the whole view. When the user taps on the button, it will trigger the closeMenuAnimated:completion: action. I'd be willing to work on making this a pull request if you think it's a PR that you will accept.

Safyan123 commented 9 years ago

I have disable the userInteraction of View Controller but it is still touching the Slide Out View Controller .. please Help me how i Disable it ???

nverinaud commented 9 years ago

@Safyan123 I do not understand your issue. The idea is to disable user interaction on the subviews of your content view controller's view.

Safyan123 commented 9 years ago

@nverinaud i am using multiple classes in which i am using UitableView as a subview of View controller . when i go to an other view Controller by using navigation pusViewController and then i am sliding the menuView by PanGesture it open the Menu . thats fine but problem is when i close/Slide in menuView by panGusture then it do not close the slide menu but it is changing my viewController and go to previous viewController's screen. because that screen part is enable My Question is about this issue please tell me a solution how can i disable my view controller so that it do not go back to previous screen and close or slidein MenuView .. ??

Safyan123 commented 9 years ago

@nverinaud i am using multiple classes in which i am using UitableView as a subview of View controller . when i go an other view Controller by using navigation pusViewController and then i am sliding the menuView by PanGesture it open the Menu . thats fine but problem is when i close/Slide in menu View by panGusture then it do not close the slide menu but it is changing my viewController and go to previous viewController's screen. because that screen part is enable My Question is about this issue please tell me a solution how can i disable my view controller so that it do not go back to previous screen .. ?? For help i am attaching my screen snap

On Thu, Sep 25, 2014 at 4:56 PM, Nicolas VERINAUD notifications@github.com wrote:

@Safyan123 https://github.com/Safyan123 I do not understand your issue. The idea is to disable user interaction on the subviews of your content view controller's view.

— Reply to this email directly or view it on GitHub https://github.com/nverinaud/NVSlideMenuController/issues/27#issuecomment-56808260 .

nverinaud commented 9 years ago

@Safyan123 If I understand it correctly. The menu is open. You can interact with the navigation bar on top of the content view controller, ie. you can tap the back button which trigger a back navigation in the content view controller. The solution is to disable user interaction on the back button using self.navigationItem.backBarButtonItem.enabled = NO in your current content view controller.

Safyan123 commented 9 years ago

@nverinaud Thanku for you Response Dear you pick my point but not correctly i am not talking about to tap on navigation button to go back i am talking about to go back or close the slidemenu screen by using Guesture but when i close slide menu by using Guesture then it interact with my main ViewController's Screen. Now if you got it ?? then i am asking for it how to disable user interaction with main ViewController

nverinaud commented 9 years ago

@Safyan123 You can't disable user interaction on the top view controller's view since it will disable the gesture too (the gesture is attached to the top view controller's view). You can disable user interaction on the subviews though. Let me explain it with an example.

Your view controller is composed of this view hierarchy :

view
|--- navigationBar
|-------- buttons
|--- tableView
|-------- cells
|--- toolbar
|-------- buttons

The idea is to disable interactions on the subviews like this :

view [enabled]
|--- navigationBar [enabled]
|-------- buttons [disabled]
|--- tableView [disabled]
|-------- cells [enabled]
|--- toolbar [enabled]
|-------- buttons [disabled]

You should disable the subviews by implementing the viewDidSlideOut:inSlideMenuController: callback method explained in the README. You should reenable them by implementing the viewDidSlideIn:inSlideMenuController: callback.

Safyan123 commented 9 years ago

Okay thanku ... I have try it and disable the uitableview interaction like this [self.tableVeiw setuserinteractionenable:NO]; But it is still enable :-(

On Thursday, September 25, 2014, Nicolas VERINAUD notifications@github.com wrote:

@Safyan123 https://github.com/Safyan123 You can't disable user interaction on the top view controller's view since it will disable the gesture too (the gesture is attached to the top view controller's view). You can disable user interaction on the subviews though. Let me explain it with an example.

Your view controller is composed of this view hierarchy :

view |--- navigationBar |-------- buttons |--- tableView |-------- cells |--- toolbar |-------- buttons

The idea is to disable interactions on the subviews like this :

view [enabled] |--- navigationBar [enabled] |-------- buttons [disabled] |--- tableView [disabled] |-------- cells [enabled] |--- toolbar [enabled] |-------- buttons [disabled]

— Reply to this email directly or view it on GitHub https://github.com/nverinaud/NVSlideMenuController/issues/27#issuecomment-56820760 .

Sent from Gmail Mobile

nverinaud commented 9 years ago

You are encountering an issue not related to this library. Make sure self.tableView is not nil.

Safyan123 commented 9 years ago

Data is loaded in uitableView i debug it but still this problem is there :-|

On Thursday, September 25, 2014, Nicolas VERINAUD notifications@github.com wrote:

You encounter an issue not related to this library. Make sure self.tableView is not nil.

— Reply to this email directly or view it on GitHub https://github.com/nverinaud/NVSlideMenuController/issues/27#issuecomment-56825869 .

Sent from Gmail Mobile

Safyan123 commented 9 years ago

@nverinaud Thanku so much for your help I solved this problem this problem is not due to UITableview in my case i was using uitabbar and using uinavigation in different view's , so the problem was due to interactionPopGestureRecognizer i disable it and it has solved :)

On Thu, Sep 25, 2014 at 7:47 PM, Safyan Mughal softexpert100@gmail.com wrote:

Data is loaded in uitableView i debug it but still this problem is there :-|

On Thursday, September 25, 2014, Nicolas VERINAUD < notifications@github.com> wrote:

You encounter an issue not related to this library. Make sure self.tableView is not nil.

— Reply to this email directly or view it on GitHub https://github.com/nverinaud/NVSlideMenuController/issues/27#issuecomment-56825869 .

Sent from Gmail Mobile

nverinaud commented 9 years ago

@Safyan123 Great ! :-)