Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/objective-c/26.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Iphone UIPopover-将中的子视图的帧大小更改为contentViewController.view的指定方法是什么?_Iphone_Objective C_Ipad - Fatal编程技术网

Iphone UIPopover-将中的子视图的帧大小更改为contentViewController.view的指定方法是什么?

Iphone UIPopover-将中的子视图的帧大小更改为contentViewController.view的指定方法是什么?,iphone,objective-c,ipad,Iphone,Objective C,Ipad,在UIPover的contentViewController中尝试更改帧大小或视图的隐藏属性没有任何成功。我试图以编程方式更改contentViewController.view子视图的帧大小,但无法更改。无论xib初始化了什么帧,它都会保留。现在,我尝试为每个设备方向输入两个具有正确帧大小的子视图,并使用hidden属性使具有正确帧大小的视图可见。xib最初有每个“.hidden:YES”。我无法使用“.hidden:NO”使其中一个可见 具体来说,我在popover中有一个UIImageVi

在UIPover的contentViewController中尝试更改帧大小或视图的隐藏属性没有任何成功。我试图以编程方式更改contentViewController.view子视图的帧大小,但无法更改。无论xib初始化了什么帧,它都会保留。现在,我尝试为每个设备方向输入两个具有正确帧大小的子视图,并使用hidden属性使具有正确帧大小的视图可见。xib最初有每个“.hidden:YES”。我无法使用“.hidden:NO”使其中一个可见

具体来说,我在popover中有一个UIImageView,我希望它在每个方向上都尽可能大,同时保留它包含的图片的纵横比

一些代码

UIInterfaceOrientation interfaceOrientation=[self interfaceOrientation]

// If a saveOrPrintPopover is not already showing, create it.
if(self.saveOrPrintPopover){
    [self   closeSaveOrPrintPopover];

    keyImageView.image = appDelegate.lineImage;
    appDelegate.lineImage = NULL;
    content.printView.image = NULL;
}else{
                    ////////    UIPopoverController created here !
    saveOrPrintPopover = [[UIPopoverController alloc] initWithContentViewController:content];
    content.view.frame = CGRectMake(0, 0, 1024, 748);

    SaveOrPrintViewController *cntrler = (SaveOrPrintViewController *)saveOrPrintPopover.contentViewController;
    if (interfaceOrientation == UIInterfaceOrientationPortrait || interfaceOrientation == UIInterfaceOrientationPortraitUpsideDown) {
        saveOrPrintPopover.popoverContentSize = CGSizeMake(748, 940);
        cntrler.landscapeBackingView.hidden = YES;
        cntrler.portraitBackingView.hidden = NO;
    }
    else {
        saveOrPrintPopover.popoverContentSize = CGSizeMake(984, 664);
        cntrler.landscapeBackingView.hidden = NO;
        cntrler.portraitBackingView.hidden = YES;

    }
    [content.view   setNeedsLayout];
    [content.view   layoutIfNeeded];

    saveOrPrintPopover.delegate = self;

    appDelegate.lineImage = keyImageView.image;
    keyImageView.image = NULL;
}
[self   showPopoverFromBarButtonItem];

您可以更改popover的大小:

[saveOrPrintPopover设置PopOverContentSize:CGSizeMake(320560)]


您的内容视图应该正确配置为自动调整大小。

您所说的:不能使用隐藏=否是什么意思?您是否尝试在这些行上设置断点以检查它们是否已执行?什么时候调用引用的函数?如何在此代码中实例化
content