我正在使用 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];
}
}
请告诉我我错过了什么
提前致谢