我正在使用UIPresentationController进行菜单
的自定义模式演示这部分很好,假设我点击了“反馈”,我在其上面展示了另一个控制器。
问题是在解除反馈控制器后,菜单视图的大小变满
我的演示控制器类位于
之下#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];
}
}
请告诉我缺少的东西
提前致谢