-(voID)showEditMenuFrom:(UIbutton *)button{ if (self.popover) { [self.popover dismisspopoverAnimated:YES]; self.popover = nil; } else { EditMenuVIEwController *editMenuVIEwController = [[EditMenuVIEwController alloc] initWithNibname:@"EditMenuVIEwController" bundle:nil]; UINavigationController *actionsNavigationController = [[UINavigationController alloc] initWithRootVIEwController:editMenuVIEwController]; actionsNavigationController.delegate = self; // switch for iPhone and iPad. if ([[UIDevice currentDevice] userInterfaceIdiom] == UIUserInterfaceIdiomPad) { self.popover = [[UIPopoverController alloc] initWithContentVIEwController:actionsNavigationController]; self.popover.delegate = self; // CGRect presentFrame = CGRectMake(button.frame.origin.x-43,button.frame.origin.y-10,button.frame.size.wIDth,button.frame.size.height); [self.popover presentPopoverFromrect:button.frame inVIEw:button permittedArrowDirections:UIPopoverArrowDirectionAny animated:YES]; } else { [self presentVIEwController:actionsNavigationController animated:YES completion:^{ NSLog(@"Activity complete"); }]; } } }
我尝试在导航时调整UIPopover内部的视图,这些是结果:
>根视图:
2.推向其他VC
3.回到:
您可以看到根VC的高度无法更改回原点大小.
我尝试在vIEwDIDAppear,vIEwDIDLoad和UINavigationControllerDelegate中设置contentSizeforVIEwInPopover但是没有方法可以工作
-(voID)navigationController:(UINavigationController *)navigationController willShowVIEwController:(UIVIEwController *)vIEwController animated:(BOol)animated{ NSLog(@"Show VIEW %@",vIEwController); if ([vIEwController isKindOfClass:[EditMenuVIEwController class]]) { vIEwController.contentSizeforVIEwInPopover = CGSizeMake(160.0,160.0); } else { vIEwController.contentSizeforVIEwInPopover = CGSizeMake(320.0,320.0); }}
如何解决这个问题呢?谢谢!
解决方法 我结束了我的问题,有人遇到这个解决方案:首先,你需要在VC中声明一个在堆栈中d出的@property
@property (nonatomic,strong) UIPopoverController *popover;
然后在主代码中将其分配给UIPopoverController
self.popover = [[UIPopoverController alloc] initWithContentVIEwController:actionsNavigationController];self.popover.delegate = self;editMenuVIEwController.popover = self.popover;
最后,在要调整大小的VC的vIEwWillAppear中设置大小
-(voID)vIEwWillAppear:(BOol)animated{ [self.popover setPopoverContentSize:CGSizeMake(160,160)]; self.contentSizeforVIEwInPopover = CGSizeMake(160,160); [super vIEwWillAppear:animated];}总结
以上是内存溢出为你收集整理的ios – 无法在UIPopover的UINavigationController侧调整UIViewController的高度contentSizeForViewInPopover全部内容,希望文章能够帮你解决ios – 无法在UIPopover的UINavigationController侧调整UIViewController的高度contentSizeForViewInPopover所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)