iOS 6中的导航栏看起来像iOS 7中的栏 [英] Navigation bar in iOS 6 look like bar in iOS 7
本文介绍了iOS 6中的导航栏看起来像iOS 7中的栏的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
有没有办法让iOS 6中的导航栏元素(后退按钮)看起来像iOS 7中的导航栏元素?
以及UI的按钮和其他iOS 7元素。
Is there any way to make navigation bar elements (back button) in iOS 6 look like navigation bar elements in iOS 7 ? And also buttons and other iOS 7 elements of UI.
推荐答案
而不是将代码放入每个视图控制器中需要自定义,我建议在整个应用程序中执行此操作,方法是将这样的内容放在应用程序中:在App Delegate中使用didFinishLaunchingWithOptions:
方法
Instead of putting code into every view controller that you need to customize, I would recommend doing this for the entire application by putting something like this in your application:didFinishLaunchingWithOptions:
method in the App Delegate
// Nav bar
[[UINavigationBar appearance] setBackgroundImage:[[UIImage imageNamed:@"navBar.png"] resizableImageWithCapInsets:UIEdgeInsetsMake(10, 5, 10, 5)] forBarMetrics:UIBarMetricsDefault];
// Back buttons
[[UIBarButtonItem appearance] setBackButtonBackgroundImage:[UIImage imageNamed:@"backNavButton.png"] forState:UIControlStateNormal barMetrics:UIBarMetricsDefault];
// Toolbar
[[UIToolbar appearance] setBackgroundImage:[[UIImage imageNamed:@"toolbar.png"] resizableImageWithCapInsets:UIEdgeInsetsMake(10, 5, 10, 5)] forToolbarPosition:UIToolbarPositionAny barMetrics:UIBarMetricsDefault];
这篇关于iOS 6中的导航栏看起来像iOS 7中的栏的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文