-1

我正在尝试显示一个带有标题的弹出框,创建一个根视图控制器并用我的 viewController 实例化它。但是,当我显示弹出框时,不会显示内容。这是代码:

        UIViewController *popContentViewController = [[sb instantiateViewControllerWithIdentifier:@"videosTutoriais"] init];
    UINavigationController *controller = [[UINavigationController alloc] initWithRootViewController:popContentViewController];
    _popover = [[UIPopoverController alloc] initWithContentViewController:controller];
    _popover.delegate = self;

    [popContentViewController release];
    [controller release];

    //dados.myPopoverController = popOverController;
    [[self popover] presentPopoverFromRect:ancora.bounds inView:ancora permittedArrowDirections:UIPopoverArrowDirectionAny animated:YES];

更具体地说,弹出框的标题正常显示,但内容没有。

4

3 回答 3

0

The code looked like this:

sb = [UIStoryboard storyboardWithName:@"MainStoryboard_iPad" bundle:nil];

    UINavigationController *controller = [[sb instantiateViewControllerWithIdentifier:@"navTutorial"] init];
    _popover = [[UIPopoverController alloc] initWithContentViewController:controller];

    [[self popover] presentPopoverFromRect:ancora.bounds inView:ancora permittedArrowDirections:UIPopoverArrowDirectionAny animated:YES];
    [controller release];
于 2013-08-30T12:15:43.987 回答
0

只需仔细检查 popContentViewController 是否不为零。您有标识符@“videosTutoriais”,看起来可能是扫描错误。

于 2013-08-29T14:30:38.043 回答
0

从您的代码中,您在屏幕上显示之前释放控制器。尝试在 dealloc 方法之后或中释放它。如果您不确定内存管理。我建议您尝试使用 ARC 来避免诸如此类的愚蠢错误和错误。

于 2013-08-29T14:36:48.577 回答