如何在UIPopover控制器中获取导航栏 [英] How to get Navigation bar inside UIPopover Controller

查看:79
本文介绍了如何在UIPopover控制器中获取导航栏的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用带导航栏的uipopover控制器。实际上我想在弹出控制器中有导航栏。我尝试改变导航控制器的背景颜色,但它看起来并不像我预期的那样。导航栏按钮似乎附有弹出角落。请找到附带的截图。下面是我用来创建弹出窗口的代码。

I am using a uipopover controller with navigation bar.Actually i want to have navigation bar inside the popover controller. i tried changing the background color of the navigation controller but it didnt look as i expected.The navigation bar buttons seems to be attached with the popover corners.Please find the screenshot attached.Below is my code which i used to create the popover.

WLViewBookmarkViewController * viewBookmarkViewController = [[WLViewBookmarkViewController alloc] initWithStyle:UITableViewStyleGrouped];

WLViewBookmarkViewController * viewBookmarkViewController = [[WLViewBookmarkViewController alloc] initWithStyle:UITableViewStyleGrouped];

viewBookmarkViewController.delegate = self;
UINavigationController * viewBookmarkNavController = [[UINavigationController alloc] initWithRootViewController:viewBookmarkViewController];

viewBookmarkViewController.delegate = self; UINavigationController *viewBookmarkNavController = [[UINavigationController alloc] initWithRootViewController:viewBookmarkViewController];

viewBookmarkNavController.navigationBar.backgroundColor = [UIColor colorWithRed:9 / 255.0 green:135 / 255.0蓝色:46 / 255.0 alpha:1.0];

viewBookmarkNavController.navigationBar.backgroundColor = [UIColor colorWithRed:9/255.0 green:135/255.0 blue:46/255.0 alpha:1.0];

self.bookmarkPopoverController = [[UIPopoverController alloc] initWithContentViewController:viewBookmarkNavController];

self.bookmarkPopoverController = [[UIPopoverController alloc] initWithContentViewController:viewBookmarkNavController];

[self.bookmarkPopoverController presentPopoverFromBarButtonItem:bookmarkButtonItem allowedArrowDirections:UIPopoverArrowDirectionDown | UIPopoverArrowDirectionUp
animated:YES];

[self.bookmarkPopoverController presentPopoverFromBarButtonItem:bookmarkButtonItem permittedArrowDirections:UIPopoverArrowDirectionDown|UIPopoverArrowDirectionUp animated:YES];

    Please suggest if there are any other way to achieve this.

推荐答案

我创建了一个Xib,在那里我有一个控制器的视图,我有要在popover.i中添加一个表视图和一个导航栏到视图中。

I created a Xib in where i had a view for the controller which i had to add inside the popover.i added a table view and a navigation bar into the view.

这篇关于如何在UIPopover控制器中获取导航栏的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆