0

我正在开发 iPad 应用程序。这里它由 PopOver 组成。我需要显示相机并捕获图像。为此,我使用的是 AVFoundation 框架,默认导航栏没有出现。所以我按照以下步骤操作

cameraVC = [[CameraViewController alloc] initWithNibName:@"CameraViewController" bundle:nil ];
cameraVC.navigationItem.title = @"Take Photo";

UINavigationController *naviCon = [[UINavigationController alloc]initWithRootViewController:cameraVC];

UIPopoverController *popover = [[UIPopoverController alloc] initWithContentViewController:naviCon];
 self.popoverController = popover;
 self.popoverController.delegate = self;
 self.popover.popoverContentSize = CGSizeMake(450, 350);

[self.popoverController presentPopoverFromRect:CGRectMake(295, 40, 0, 0) inView:appDelegate.splitview.view permittedArrowDirections:UIPopoverArrowDirectionUp animated:YES];

如果你已经解决了,请指导我哪里错了。在此先感谢

在此处输入图像描述

4

3 回答 3

-1

修改代码如下并检查

cameraVC = [[CameraViewController alloc] init];

UINavigationController *naviCon = [[UINavigationController alloc]initWithRootViewController:cameraVC];

UIPopoverController *popover = [[UIPopoverController alloc] initWithContentViewController:naviCon];
 [self.presentPopOverController presentPopoverFromBarButtonItem:self.yourBarButton permittedArrowDirections:UIPopoverArrowDirectionUp animated:YES];

然后在编写以下代码的viewDidLoad方法中CameraViewController

self.navigationItem.title = @"your title";
于 2013-04-01T07:41:39.700 回答
-1

如果导航栏没有出现,请在您的 cameraViewController 中添加一个 UIToolBar 来执行您想要的功能。

我在我的项目中做了这样的事情,我在 popOVer 中得到了导航栏。

        PageSelectorViewController *pageSelector=[[PageSelectorViewController  alloc]initWithStyle:UITableViewStylePlain] ;
        UINavigationController *navControl=[[UINavigationController alloc]initWithRootViewController:pageSelector];

        self.selectedPagesPopOver=[[UIPopoverController alloc]initWithContentViewController:navControl];
        [self.selectedPagesPopOver presentPopoverFromBarButtonItem:showPages permittedArrowDirections:UIPopoverArrowDirectionUp animated:YES];

我想从自定义矩形呈现 popOver 是问题,尝试从 BarButton 呈现并尝试。

于 2013-04-01T08:23:44.940 回答
-1

这可以帮助你……</p>

MyController* controller = [[MyController alloc] initWithNibName:@"MyController" bundle:nil];
UINavigationController* navController = [[UINavigationController alloc] initWithRootViewController:controller];

controller.title = @"My Title"; //or you can put this line in MyController class viewDidLoad method as self.title = @"My Title";

controller.contentSizeForViewInPopover = CGSizeMake(320.0, 480.0);

_myPopover = [[UIPopoverController alloc] initWithContentViewController:navController];

[_myPopover presentPopoverFromBarButtonItem:sender permittedArrowDirections:UIPopoverArrowDirectionUp animated:YES];
于 2013-04-01T11:05:17.317 回答