Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

implement Facebook messenger style pan to full screen view similar effect

I have implemented UIPageviewContoller to support multiple viewcontoller view at half bottom of my screen. now my question is how to support Facebook style panning effect to on of this subview on my pageview controller.

I want to achieve Facebook message style effect which they have applied in camera, in that with pan of finger we can make view as full screen. and when we pan down the same view it will adjust within original from of view.. Ihave attached some of screen for better understanding.

subview have pan gesturepan up to full screenpandown to minimizeafter pan down reset to original postion

and it should support integrative pop gesture to.

ienterative pop

I could able to get similar effect but for that i have added view to main window so view can pan to full screen but by this approach i am not able to achieve interactive pop iOS default gesture and this approach is not good with my current pageviewcontoller implementation.

and if view is added in window than if user pressed back button than window element will not move it will remain in window so windows approach is not good.

is there any other way to get similar effect? Does UIViewControllerInteractiveTransitioning may help for this ??

Thanks in advance. I know i will get better approach from you guys which will more stable for this than adding subview to window.

like image 790
Parth Patel p1nt0z Avatar asked Nov 04 '14 18:11

Parth Patel p1nt0z


1 Answers

Have you tried adding swipe gesture to your subview A?

UISwipeGestureRecognizer *swipeUp = [[UISwipeGestureRecognizer alloc] initWithTarget:self action:@selector(didSwipeScreen:)];
swipeUp.direction = UISwipeGestureRecognizerDirectionUp;
[yourSubViewA addGestureRecognizer:swipeUp];

and it's handling -

- (void)didSwipeScreen:(UISwipeGestureRecognizer *)gesture {
switch (gesture.direction) {
    case UISwipeGestureRecognizerDirectionUp: {
        [UIView animateWithDuration:0.5 delay:0.0 options:UIViewAnimationOptionCurveLinear animations:^{
            [yourSubViewA setFrame:desiredFullScreenFrame];
        } completion:^(BOOL finished) {
        }];
    }
        break;
    default:
        break;
    }
}

To bring back to default position you can add another swipe gesture with UISwipeGestureRecognizerDirectionDown or maybe just a tap gesture. And for side menu MFSideMenu is nice one.

like image 103
RoHaN Avatar answered Nov 13 '22 16:11

RoHaN