我有正常的UIViewController,其中我添加了UINavigationControllerDelegate,我在willappear中添加如下?但它不起作用?
[self.navigationController setNavigationBarHidden:NO animated:YES];
self.navigationController.navigationItem.title = @"hai";
Run Code Online (Sandbox Code Playgroud) 我试图在Storyboard中进行以下设置.

我在开头有一个表视图,当我点击一个单元格时,它需要转换到标签栏控制器,这是有效的.但是现在我想在最右边的两个控制器中找到一个标题和一个额外的导航栏按钮.
但我似乎无法拖动按钮到那里或设置标题时,没有任何显示.如何在故事板中实现此设置?
编辑:
根据以下答案更新了问题.

当我有这个新的设置(因此中间有一个额外的导航控制器)我可以在故事板中设置标题,但在运行应用程序时,添加的标题不会显示.
编辑:我已经上传了一个完全符合该设置的xcode项目.也许它可以派上用场.
storyboard uitabbarcontroller uinavigationcontroller ios uistoryboard
我有一个ViewController(B),由一个PageViewController处理,它在另一个ViewController(A)中并打开它模态.我将ViewController(B)完全置于屏幕中间.这很好用.
但是当我从一个NavigationController推送ViewController(A)时,ViewController(B)的框架变大并且延伸到NavigationBar和TabBar下面.但我希望它在NavigationBar和TabBar之间居中.
我知道如何获得导航栏和tabbar的高度,以便我可以调整ViewController(B)的大小:
var topBar = self.navigationController?.navigationBar.frame.height
var bottomBar = self.tabBarController?.tabBar.frame.height
Run Code Online (Sandbox Code Playgroud)
但是这在ViewController(B)的vier层次结构中不起作用.self.navigationController和self.tabBarController都是nil.那么如何在视图层次结构中更深入地获取导航栏和标签栏的高度?或者我只需要将它从一个ViewController传递到另一个ViewController,直到我到达ViewController(B)?还是有另一种更明显的方式来集中视图?谢谢.
(我试图发布截图以便更好地理解,但我错过了发布图片所需的声望点,抱歉)
objective-c uitabbarcontroller uinavigationcontroller ios swift
我正试图Navigation Bar在Swift中设置标题,我设置Tab Bar并且Navigation Bar没有任何显示,没有按钮,没有标题,没有.我使用了一些代码,但是当我使用Tab Bar时它没有工作,当我删除时Tab Bar,代码正常工作,一切正常Navigation Bar,标题显示,按钮显示.
我用于标题的代码是:
override func viewDidLoad() {
super.viewDidLoad()
self.navigationItem.title = "My Title"
}
Run Code Online (Sandbox Code Playgroud)
在Main.storyboard我连接Navigation Controller中Tab Bar Controller,如图片中所示.
那么,如何解决这个问题呢?问题是Navigation Bar在使用时无法正常工作Tab Bar.
我认为它并不严格符合Apple指南,但我想它必定是可能的.我想更改UINavigationController中导航栏的高度以及该栏内UIBarButtonItem元素的高度.
使用这个问题的技巧我设法改变导航栏的高度,但我看不到调整条形按钮项高度的方法.
如果有人知道如何更改条形按钮项的大小,请帮助我.
cocoa-touch uinavigationbar uinavigationcontroller uibarbuttonitem
我正在尝试以编程方式更改导航栏的标题,但我正在使用的代码不起作用.
self.navigationController.navigationBar.tintColor = [UIColor redColor];
self.navigationController.navigationItem.title=@"Hello";
Run Code Online (Sandbox Code Playgroud)
我可以设法更改栏的颜色而不是文本.
我正在尝试使用UINavigationController.我有两个以编程方式创建的视图.当UIButton在第一个视图上按下a时,第二个视图应该到达前景.
但这里的应用程序崩溃异常:
加载的笔尖但未设置视图插座
可能是什么原因以及如何解决它.
我想在导航栏中添加默认的左栏按钮项.它应该仅在UINavigationController没有提供后退按钮时显示.
什么是最好的方法?
iphone objective-c uiviewcontroller uinavigationcontroller ios
UINavigationController上的pushViewController和showViewController方法有什么区别?
我试图通过使用下一个代码将代码中的子视图控制器添加到故事板中的当前视图控制器:
UIStoryboard *storyboard = [UIStoryboard storyboardWithName:@"Main" bundle: nil];
LogInTutorialViewController *lvc = [[LogInTutorialViewController alloc] init];
lvc = (LogInTutorialViewController *)[storyboard instantiateViewControllerWithIdentifier:@"LogInTutorialViewControllerID"];
[self displayContentController:lvc];
- (void) displayContentController: (LogInTutorialViewController*) content;
{
//add as childViewController
[self addChildViewController:content];
[content didMoveToParentViewController:self];
[content.view setFrame:CGRectMake(0, 0, [UIScreen mainScreen].bounds.size.width, [UIScreen mainScreen].bounds.size.height)];
[self.view addSubview:content.view];
}
Run Code Online (Sandbox Code Playgroud)
视图似乎至少在模拟器上显示但在控制台中我得到了很多或错误:
<Error>: CGContextSaveGState: invalid context 0x0. This is a serious error. This application, or a library it uses, is using an invalid context and is thereby contributing to an overall degradation of system stability and reliability. …Run Code Online (Sandbox Code Playgroud) ios ×8
objective-c ×5
swift ×2
cocoa-touch ×1
exception ×1
iphone ×1
storyboard ×1
uistoryboard ×1
xcode ×1