我有一个简单的情节提要,其中包含带有静态表视图控制器的导航控制器。我已经添加了一个视图控制器,并通过推送功能将其连接到其中一个单元。我注意到的一件事是,导航栏标题无法使用“后退”按钮和垂直正确居中UIBarButtonItem
。这是现在看起来的图像。
请注意,它们都与底部对齐。我想要的是一种向下移动标题或向上移动按钮的方法。如果按钮向上移动,则后退按钮箭头也应移动,并允许返回主表视图。
这是我用来UIBarButtonItem
在视图控制器中设置字体的代码(如果有帮助):
[clearButton setTitleTextAttributes:[NSDictionary dictionaryWithObjectsAndKeys:[UIFont fontWithName:@"ChalkboardSE-Regular" size:15], NSFontAttributeName, [UIColor whiteColor], NSForegroundColorAttributeName, nil] forState:UIControlStateNormal];
这就是我用来为应用程序委托中的后退按钮设置字体的内容didFinishLaunchingWithOptions:
:
[[UIBarButtonItem appearanceWhenContainedIn:[UINavigationBar class], nil] setTitleTextAttributes:@{NSForegroundColorAttributeName:[UIColor whiteColor], NSFontAttributeName:[UIFont fontWithName:@"ChalkboardSE-Regular" size:15]}forState:UIControlStateNormal];
您可以使用以下命令将标题下移: [[UINavigationBar appearance] setTitleVerticalPositionAdjustment:(float) forBarMetrics:UIBarMetricsDefault];
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句