0

I to create reveal menu in my app that open it from left (top page move left to right when I drag left to right) now I so try change this but I couldn't. please guide me how I to change this menu and put it in right side and open this side (when drag right to left).

my friend this is piece of my code :

#pragma mark UITouch Logic

- (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event {

    if (_slideNavigationControllerState == kSlideNavigationControllerStateDrilledDown ||
        _slideNavigationControllerState == kSlideNavigationControllerStateSearching)
        return;

    UITouch *touch = [touches anyObject];
    _startingDragPoint = [touch locationInView:self.view];

    if ((CGRectContainsPoint(_slideNavigationController.view.frame, _startingDragPoint))
      && _slideNavigationControllerState == kSlideNavigationControllerStatePeeking) {

        _slideNavigationControllerState = kSlideNavigationControllerStateDragging;
        _startingDragTransformTx = _slideNavigationController.view.transform.tx;
    }

    // we only trigger a swipe if either navigationBarOnly is deactivated
    // or we swiped in the navigationBar
    if (!kSVCSwipeNavigationBarOnly || _startingDragPoint.y <= 44.0f) {

        _slideNavigationControllerState = kSlideNavigationControllerStateDragging;
        _startingDragTransformTx = _slideNavigationController.view.transform.tx;

    }
}

- (void)touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event {

    if (_slideNavigationControllerState != kSlideNavigationControllerStateDragging)
        return;

    UITouch *touch = [touches anyObject];

    CGPoint location = [touch locationInView:self.view];

    [UIView animateWithDuration:0.05f 
                          delay:0.0f
                         options:UIViewAnimationOptionCurveLinear |
                                 UIViewAnimationOptionBeginFromCurrentState 
        animations:^{

        _slideNavigationController.view.transform = CGAffineTransformMakeTranslation(
             MAX(_startingDragTransformTx + (location.x - _startingDragPoint.x),
              0.0f),0.0f);

        NSLog(@"%d",_slideNavigationController.view.transform);

    } completion:^(BOOL finished) {

    }];                
}

- (void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event {

    if (_slideNavigationControllerState == kSlideNavigationControllerStateDragging) {
        UITouch *touch = [touches anyObject];
        CGPoint endPoint = [touch locationInView:self.view];

        // Check in which direction we were dragging
        if (endPoint.x < _startingDragPoint.x) {
            if (_slideNavigationController.view.transform.tx <= kSVCRightAnchorX) {
                [self slideInSlideNavigationControllerView];
            } else {
                [self slideOutSlideNavigationControllerView];
            }
        } else {
            if (_slideNavigationController.view.transform.tx >= kSVCLeftAnchorX) {
                [self slideOutSlideNavigationControllerView];
            } else {
                [self slideInSlideNavigationControllerView];
            }
        }
    }

}
abbood
  • 23,101
  • 16
  • 132
  • 246
fred
  • 157
  • 2
  • 11
  • Have you thought about using a gesture recognizer or https://github.com/edgecase/ECSlidingViewController – Wain May 25 '13 at 08:40

1 Answers1

2

u want to move view to right to left.the best way to do this using swipe gesture recognization.Click on this link (swipegesture)

Community
  • 1
  • 1
Shashi Sharma
  • 126
  • 1
  • 11