• <i id='piWIV'><tr id='piWIV'><dt id='piWIV'><q id='piWIV'><span id='piWIV'><b id='piWIV'><form id='piWIV'><ins id='piWIV'></ins><ul id='piWIV'></ul><sub id='piWIV'></sub></form><legend id='piWIV'></legend><bdo id='piWIV'><pre id='piWIV'><center id='piWIV'></center></pre></bdo></b><th id='piWIV'></th></span></q></dt></tr></i><div id='piWIV'><tfoot id='piWIV'></tfoot><dl id='piWIV'><fieldset id='piWIV'></fieldset></dl></div>
    • <bdo id='piWIV'></bdo><ul id='piWIV'></ul>
  • <small id='piWIV'></small><noframes id='piWIV'>

    <legend id='piWIV'><style id='piWIV'><dir id='piWIV'><q id='piWIV'></q></dir></style></legend>
    <tfoot id='piWIV'></tfoot>

        如何在 iPhone 应用程序的 UINavigationBar 中添加图像

        How to add image in UINavigationBar in IPhone app(如何在 iPhone 应用程序的 UINavigationBar 中添加图像)
        <legend id='sxQ1U'><style id='sxQ1U'><dir id='sxQ1U'><q id='sxQ1U'></q></dir></style></legend>

        • <bdo id='sxQ1U'></bdo><ul id='sxQ1U'></ul>

          <tfoot id='sxQ1U'></tfoot>

              <small id='sxQ1U'></small><noframes id='sxQ1U'>

              1. <i id='sxQ1U'><tr id='sxQ1U'><dt id='sxQ1U'><q id='sxQ1U'><span id='sxQ1U'><b id='sxQ1U'><form id='sxQ1U'><ins id='sxQ1U'></ins><ul id='sxQ1U'></ul><sub id='sxQ1U'></sub></form><legend id='sxQ1U'></legend><bdo id='sxQ1U'><pre id='sxQ1U'><center id='sxQ1U'></center></pre></bdo></b><th id='sxQ1U'></th></span></q></dt></tr></i><div id='sxQ1U'><tfoot id='sxQ1U'></tfoot><dl id='sxQ1U'><fieldset id='sxQ1U'></fieldset></dl></div>
                    <tbody id='sxQ1U'></tbody>
                  本文介绍了如何在 iPhone 应用程序的 UINavigationBar 中添加图像的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  在我的应用程序中,我想在导航栏中添加图像(徽标).我正在开发 XCode 4.2 和 iOS 5.

                  In my app, i want to add image(logo) in Navigation bar. I am working on XCode 4.2 and iOS 5.

                  我知道 UINavigationBarUIToolBar 在 iOS 5 中已更改.所以 iOS 4.2 UINavigationBar 代码在 iOS 5 中将无法使用.

                  I know UINavigationBar, UIToolBar has been changed in iOS 5. So iOS 4.2 UINavigationBar code won't work in iOS 5.

                  我希望在 4.2 和 5 版本中都支持 UINavigationBar 中的显示图像.

                  I want to support display image in UINavigationBar in both 4.2 and 5 version.

                  我想在 UINavigationBar 中显示图像,如下图所示.

                  I want to be display image in UINavigationBar like as in below screenshot.

                  请在这方面提供帮助,如果有任何示例代码意味着它对我很有帮助.

                  Please help in this regards and if there is any sample code means its very helpful to me.

                  谢谢!!!

                  推荐答案

                  一种方法是使用 UINavigationItem.titleViewUINavigationItem.rightBarButtonItem.像这样:

                  One way to do this is to use UINavigationItem.titleView and UINavigationItem.rightBarButtonItem. Like this :

                  viewController.navigationItem.titleView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"yourimage.png"]];
                  UIBarButtonItem * item = [[UIBarButtonItem alloc] initWithCustomView:[[UIImageView alloc] initWithImage:[UIImage imageNamed:@"yourimage2.jpg"]]];    
                  viewController.navigationItem.rightBarButtonItem = item;    
                  

                  这里我使用 UIImageView 作为自定义视图,但它可以是带有自定义图像的 UIButton.

                  Here I am using UIImageView as custom view, but it can be UIButton with custom image.

                  这篇关于如何在 iPhone 应用程序的 UINavigationBar 中添加图像的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  本站部分内容来源互联网,如果有图片或者内容侵犯了您的权益,请联系我们,我们会在确认后第一时间进行删除!

                  相关文档推荐

                  UINavigationController inside a UITabBarController inside a UISplitViewController presented modally on iPhone(UISplitViewController 内的 UITabBarController 内的 UINavigationController 以模态方式呈现在 iPhone 上) - IT屋-程序员软件开发技术分
                  ViewController in UINavigationController orientation change(UINavigationController 中的 ViewController 方向更改)
                  Custom back button in UINavigationController(UINavigationController 中的自定义后退按钮)
                  How to get the previous viewcontroller that pushed my current view(如何获取推送我当前视图的上一个视图控制器)
                  The correct way to set a light status bar text color in iOS 7 based on different ViewControllers(iOS 7中基于不同ViewControllers设置灯光状态栏文字颜色的正确方法)
                  Show UITabBar when UIViewController pushed(推送 UIViewController 时显示 UITabBar)
                • <tfoot id='o0xMX'></tfoot>
                    <tbody id='o0xMX'></tbody>

                      <i id='o0xMX'><tr id='o0xMX'><dt id='o0xMX'><q id='o0xMX'><span id='o0xMX'><b id='o0xMX'><form id='o0xMX'><ins id='o0xMX'></ins><ul id='o0xMX'></ul><sub id='o0xMX'></sub></form><legend id='o0xMX'></legend><bdo id='o0xMX'><pre id='o0xMX'><center id='o0xMX'></center></pre></bdo></b><th id='o0xMX'></th></span></q></dt></tr></i><div id='o0xMX'><tfoot id='o0xMX'></tfoot><dl id='o0xMX'><fieldset id='o0xMX'></fieldset></dl></div>

                      1. <small id='o0xMX'></small><noframes id='o0xMX'>

                        <legend id='o0xMX'><style id='o0xMX'><dir id='o0xMX'><q id='o0xMX'></q></dir></style></legend>
                        • <bdo id='o0xMX'></bdo><ul id='o0xMX'></ul>