ipad UIPopoverController 与 UINavigationController

发布于 2024-11-02 03:37:08 字数 1696 浏览 1 评论 0原文

如何创建带有集成 UINavigationController 的 UIPopoverController,以便我能够在 UIPopoverController 内左右滑动视图(带有导航栏)。

更新: 我像这样打开弹出窗口

- (void)showSettingsViewAtSenderForIPad:(id)sender
{
    if (!settingsPopoverController_) 
    {
        SettingsPopoverController *settings = [[SettingsPopoverController alloc] init];
        settings.valuesGeneratorOptions = valuesGeneratorOptions_; // setting variables

        self.settingsPopoverController_ = [[[UIPopoverController alloc] initWithContentViewController:settings] autorelease];
        [settingsPopoverController_ setDelegate:self];
        [settingsPopoverController_ setPopoverContentSize:CGSizeMake(320, 480)];

        [settings release];
    }

    if (!infoPopoverController_.popoverVisible) 
    {
        [settingsPopoverController_ presentPopoverFromBarButtonItem:sender permittedArrowDirections:UIPopoverArrowDirectionAny animated:NO];
    }
}

我创建了一个控制器,该控制器在 UINavigationController 中将 NSTableViewController 作为根控制器。

@interface SettingsPopoverController : UIViewController 
{
    ValuesGeneratorOptions *valuesGeneratorOptions;
    IBOutlet SettingsViewController *settingsViewController;
    IBOutlet UINavigationController *navigationController;
}
...
@implementation SettingsPopoverController
...
- (void)viewDidLoad
{
    self.settingsViewController.valuesGeneratorOptions = self.valuesGeneratorOptions;
    [self.view addSubview:self.navigationController.view];

    [super viewDidLoad];
}
...
end

问题是,该表在弹出窗口内不可滚动。它还忽略表格样式(未调用 initWithStyle)。 使固定?

解决方案: 找到解决方案:popOver table view

How can I create a UIPopoverController with integrated UINavigationController so I will be able to slide views inside the UIPopoverController left-right (with navigation bar).

UPDATE:
I open popup like this

- (void)showSettingsViewAtSenderForIPad:(id)sender
{
    if (!settingsPopoverController_) 
    {
        SettingsPopoverController *settings = [[SettingsPopoverController alloc] init];
        settings.valuesGeneratorOptions = valuesGeneratorOptions_; // setting variables

        self.settingsPopoverController_ = [[[UIPopoverController alloc] initWithContentViewController:settings] autorelease];
        [settingsPopoverController_ setDelegate:self];
        [settingsPopoverController_ setPopoverContentSize:CGSizeMake(320, 480)];

        [settings release];
    }

    if (!infoPopoverController_.popoverVisible) 
    {
        [settingsPopoverController_ presentPopoverFromBarButtonItem:sender permittedArrowDirections:UIPopoverArrowDirectionAny animated:NO];
    }
}

I created a controller which has a NSTableViewController as a root controller in UINavigationController

@interface SettingsPopoverController : UIViewController 
{
    ValuesGeneratorOptions *valuesGeneratorOptions;
    IBOutlet SettingsViewController *settingsViewController;
    IBOutlet UINavigationController *navigationController;
}
...
@implementation SettingsPopoverController
...
- (void)viewDidLoad
{
    self.settingsViewController.valuesGeneratorOptions = self.valuesGeneratorOptions;
    [self.view addSubview:self.navigationController.view];

    [super viewDidLoad];
}
...
end

The problem is, that the table is not scrollable inside the popup. It also ignores the table style (initWithStyle not called).
Fix?

SOLUTION:
Found the solution: popOver table view

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

掐死时间 2024-11-09 03:37:08

您创建一个新的笔尖和一个 UIViewController。这个笔尖有一个普通的简 UIView 和一个 UINavigationController,因为它是顶级视图。 UINavigationController 的顶级 UIViewController 是您想要首先显示的任何视图控制器。

然后,您可以在弹出窗口控制器中显示此笔尖。在视图加载时,您可以执行以下操作:

-(void)viewDidLoad
{
    [self.view addSubview:self.navigationController.view];
}

这会将导航控制器的视图添加到笔尖中的视图中,从而允许显示它。

You create a new nib and a UIViewController. This nib has, as it's top level view, a plain jane UIView and a UINavigationController. The UINavigationController's top UIViewController is whatever view controller you want to display first.

You then display this nib inside your popover controller. In the view did load, you do something like this:

-(void)viewDidLoad
{
    [self.view addSubview:self.navigationController.view];
}

This adds your navigation controller's view to your view in your nib, which allows it to be displayed.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文