Ios 使用uipresentationController进行自定义演示时出现问题
我正在使用UIPresentationController为菜单自定义模式演示 这部分很好,假设我点击了“反馈”,我在上面展示另一个控制器 问题是在关闭反馈控制器后,菜单视图的大小变满 下面是我的演示控制器类Ios 使用uipresentationController进行自定义演示时出现问题,ios,objective-c,ios8,custom-transition,uipresentationcontroller,Ios,Objective C,Ios8,Custom Transition,Uipresentationcontroller,我正在使用UIPresentationController为菜单自定义模式演示 这部分很好,假设我点击了“反馈”,我在上面展示另一个控制器 问题是在关闭反馈控制器后,菜单视图的大小变满 下面是我的演示控制器类 #import "MRMenuPresentationController.h" @implementation MRMenuPresentationController @synthesize dimmingView; -(void)presentationTransitionW
#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];
}
}
#导入“MRMenuPresentationController.h”
@实现MRMenuPresentationController
@综合调光视图;
-(无效)表示转换将开始
{
UITapGestureRecognitor*手势=[UITapGestureRecognitor new];
所需的TapSpiration.numberOfTapsRequired=1;
所需的TapSpiration.NumberofTouches=1;
[手势添加目标:自我操作:@selector(handleTap:)];
dimmingView=[UIView新建];
[调光视图添加手势识别器:手势];
dimmingView.backgroundColor=[[UIColor blackColor]colorWithAlphaComponent:0.7];
self.dimmingView.frame=self.containerView.bounds;
self.dimmingView.alpha=0.0;
[self.containerView添加子视图:暗显视图];
[self.containerView添加子视图:self.presentedView];
//在渐变旁边的变暗视图中淡入
id transitionCoordinator=self.presentingViewController.transitionCoordinator;
[transitionCoordinator AnimateLongsideTransition:^(id上下文){
self.dimmingView.alpha=1.0;
}完成:无];
}
-(无效)演示文稿翻译结束:(BOOL)已完成
{
如果(!已完成){
[自调暗视图从SuperView移除];
}
}
-(CGRect)PresentedViewContainerView框架
{
CGRect frame=self.containerView.bounds;
frame.size.width=frame.size.width-50;
返回框;
}
-(无效)解雇转换将开始
{
id transitionCoordinator=self.presentingViewController.transitionCoordinator;
[transitionCoordinator AnimateLongsideTransition:^(id上下文){
self.dimmingView.alpha=0.0;
}完成:无];
}
-(无效)解雇转换终止:(BOOL)已完成
{
如果(已完成){
[自调暗视图从SuperView移除];
}
}
请告诉我遗漏了什么
提前感谢您是否尝试覆盖处理大小的
UIPresentationController
的其他方法?您如何呈现反馈控制器?它有哪种演示样式?通过使用UIModalPresentationOverFullScreen演示样式以自定义大小从视图控制器演示解决了这一问题。我有一个答案: