Objective c 切换到UIPopoverPresentationController
我想为我的iPhone应用程序创建相同的popover,大小为Objective c 切换到UIPopoverPresentationController,objective-c,ios8,uipopovercontroller,uipopover,uipopoverbackgroundview,Objective C,Ios8,Uipopovercontroller,Uipopover,Uipopoverbackgroundview,我想为我的iPhone应用程序创建相同的popover,大小为GGrectof(320 100.0)。 这是我的旧代码: View*pk1=[[View alloc]init]; UINavigationController*nav=[[UINavigationController alloc]initWithRootViewController:pk1]; pop=[[UIPOPCovercontroller alloc]initWithContentViewController:nav];
GGrect
of(320 100.0)
。
这是我的旧代码:
View*pk1=[[View alloc]init];
UINavigationController*nav=[[UINavigationController alloc]initWithRootViewController:pk1];
pop=[[UIPOPCovercontroller alloc]initWithContentViewController:nav];
[pop setDelegate:self];
[pop presentPopoverFromRect:[self-btnsavepart]。查看中的帧:[self-view]许可证行方向:UIPopOverErrorDirection任意动画:是];
[导航释放];
我使用这个代码,但它不会改变
nav.preferredContentSize = CGSizeMake(320, 100);
我无法使用uipopoperpresentationcontroller
更改uipoperpresentationcontroller
如何指定(320 100.0)
的GGrect
我认为我只能在水平方向上改变,但我怎么做呢
View *viewController = [[[View alloc] init] autorelease];
UINavigationController *navController = [[[UINavigationController alloc] initWithRootViewController:viewController] autorelease];
navController.modalPresentationStyle = UIModalPresentationPopover;
navController.popoverPresentationController.permittedArrowDirections = UIPopoverArrowDirectionUp;
navController.popoverPresentationController.sourceRect = btnsavepart.bounds;
navController.popoverPresentationController.sourceView = btnsavepart;
navController.popoverPresentationController.delegate = self;
[self presentViewController:navController animated:YES completion:nil];
我希望UIPopoverPresentationController不是iPhone中的全屏形式
我添加了这些代码,但我给出了全屏视图
- (UIModalPresentationStyle)adaptivePresentationStyleForPresentationController:(UIPresentationController *)controller
{
}我使用Xamarin,但它是一样的,要指定要在其中显示UIViewController的popover的大小,在UIViewController的属性中,您有PreferredContentSize属性。在这里您可以指定大小
我在这里的某个地方看到了它,但忘记了它的位置。可能是重复的我不认为它是重复的,因为“我不能用UIPopoverPresentationController更改UIpopovercontriller”。@jww为什么会有不同?这个问题中的OP试图使用
UIPopoverPresentationController
在这个问题中呈现一个popover,就像在重复的问题中一样。首先,它不是重复的,如果你有hi@user2296278,请给我解决方案。你找到解决方案了吗?
return NO;