KieranLafferty / KLNoteViewController

A view controller that organizes multiple navigation controllers in a stack inspired by Evernote 5.0 app
Other
923 stars 147 forks source link

Click on KLControllerCard set Card in fullscreen state #26

Closed coco6612 closed 10 years ago

coco6612 commented 11 years ago

A question: How can I manage the following: User clicks anywhere on ViewController in KLControllerCardStateDefault -> ViewController state change to KLControllerCardStateFullScreen

Similar to Evernote app. Can you give me some hints?

KieranLafferty commented 11 years ago

Currently the behaviour for this is set to a double click which allows buttons to be still be useful in the view (i.e. single click goes to view controller view, double click toggles the full screen behaviour. This behaviour can be modified by changing the following in the .m file

//Gesture properties
#define kDefaultNumberOfTapsRequired 2

Behaviour for deciding where the tap gesture is added is determined by the following:

If the root class of the of the View Controller is a UINavigationController, the tap gesture is added to the nav controllers toolbar

If the root class of the of the View Controller is a UIViewController, the tap gesture is added to the view controllers view

This can be seen in the following code

    if ([_viewController isKindOfClass:[UINavigationController class]]
            && self.noteViewController.cardPanGestureScope == KLControllerCardPanGestureScopeNavigationBar) {
        [[(UINavigationController*)_viewController navigationBar] addGestureRecognizer: _panGesture];

        //Add Tap gesture
        if (self.noteViewController.cardEnablePressGesture) {
            //Add the gesture to the navigation bar
            [[(UINavigationController*)_viewController navigationBar]  addGestureRecognizer: _tapGesture];
        }
    }
    else {
        //Add pan gesture to view
        [_viewController.view addGestureRecognizer: _panGesture];
        //Add Tap gesture
        if (self.noteViewController.cardEnablePressGesture) {
            //Add the gesture to the navigation bar
            [_viewController.view addGestureRecognizer: _tapGesture];
        }
    }