issue in using uipresentationController for custom presentation

1.3k views Asked by At

i am using UIPresentationController for custom modal presentation for menuenter image description here

this part is fine , let say i have clicked 'feedback' i am presenting another controller on top of it .

the problem is after dismissing feedback controller the size of menu view become full enter image description here

my presentation controller class is below

#import "MRMenuPresentationController.h"

@implementation MRMenuPresentationController

@synthesize dimmingView;


-(void)presentationTransitionWillBegin
{

    UITapGestureRecognizer * theTapGesture = [UITapGestureRecognizer new];

    theTapGesture.numberOfTapsRequired = 1;

    theTapGesture.numberOfTouchesRequired = 1;

    [theTapGesture addTarget:self action:@selector(handleTap:)];

    dimmingView = [UIView new];

    [dimmingView addGestureRecognizer:theTapGesture];

    dimmingView.backgroundColor = [[UIColor blackColor] colorWithAlphaComponent:0.7];

    self.dimmingView.frame = self.containerView.bounds;

    self.dimmingView.alpha = 0.0;

    [self.containerView addSubview:dimmingView];
    [self.containerView addSubview:self.presentedView];

    // Fade in the dimming view alongside the transition
    id<UIViewControllerTransitionCoordinator> transitionCoordinator = self.presentingViewController.transitionCoordinator;

    [transitionCoordinator animateAlongsideTransition:^(id<UIViewControllerTransitionCoordinatorContext> context) {

        self.dimmingView.alpha  = 1.0;

    } completion:nil];


}

-(void)presentationTransitionDidEnd:(BOOL)completed
{
    if (!completed) {

        [self.dimmingView removeFromSuperview];
    }
}

-(CGRect)frameOfPresentedViewInContainerView
{
    CGRect frame = self.containerView.bounds;

    frame.size.width = frame.size.width - 50 ;

    return frame;
}

-(void)dismissalTransitionWillBegin
{
    id<UIViewControllerTransitionCoordinator> transitionCoordinator = self.presentingViewController.transitionCoordinator;

    [transitionCoordinator animateAlongsideTransition:^(id<UIViewControllerTransitionCoordinatorContext> context) {

        self.dimmingView.alpha  = 0.0;

    } completion:nil];

}

-(void)dismissalTransitionDidEnd:(BOOL)completed
{
    if (completed) {

        [self.dimmingView removeFromSuperview];
    }
}

please tell what i am missing

Thanks in advance

0

There are 0 answers