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

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

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

        继承 UINavigationController 的步骤

        时间:2023-06-11

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

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

                <legend id='Jt3D2'><style id='Jt3D2'><dir id='Jt3D2'><q id='Jt3D2'></q></dir></style></legend>

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

                  <tbody id='Jt3D2'></tbody>

                1. 本文介绍了继承 UINavigationController 的步骤的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  我想继承 UINavigationController 以获得更多关于控制器外观的自由.

                  I would like to subclass the UINavigationController to get some more freedom in regards to the appearance of the controller.

                  我有一些用于不同部分、条形、按钮、文本等的图形.查看 UINavigationController 头文件我得到的帮助很少,我不知道从哪里开始.

                  I have some graphics for the different parts, bars, buttons, text etc. Looking at the UINavigationController header file I get little help, I don't know where to start out.

                  我之前从未继承过/覆盖 UIKit 组件,这似乎有点像玩福尔摩斯.

                  I have never subclassed/overridden a UIKit component before, it seems it is a bit like playing Sherlock Holmes.

                  方法是什么?

                  我如何知道要覆盖哪些内容才能将特定图形注入"到正确的位置?

                  我是否需要继承 UINavigationBar、UIBarButtonItem 等以获得完整的自定义外观?

                  我如何知道某些内容是否无法获得 Apple 的批准?

                  希望有人能指出我正确的方向,我只能找到更改控制器小部分的示例,而不是通过子类化进行完全自定义.我是不是走错了路?

                  Hope someone can point me in the right direction, I have only been able to find examples of changing small parts of the controller, not a full customization by subclassing. Am I going about this the wrong way?

                  谢谢:)

                  推荐答案

                  你不应该扩展 UINavigationController.

                  You should NOT extend UINavigationController.

                  从 iOS 6 开始,此信息已过时.来自 Xcode 5 文档:您通常按原样使用此类,但在 iOS 6 及更高版本中,您可以子类化以自定义类行为.

                  As of iOS 6, this information is outdated. From the Xcode 5 docs: You generally use this class as-is but in iOS 6 and later you may subclass to customize the class behavior.

                  原始过时信息如下:

                  来自文档:

                  UINavigationController 类实现了一个专门的视图控制器,用于管理分层内容的导航.此类不用于子类化.相反,在您希望应用程序的用户界面反映内容的分层性质的情况下,您可以按原样使用它的实例.

                  The UINavigationController class implements a specialized view controller that manages the navigation of hierarchical content. This class is not intended for subclassing. Instead, you use instances of it as-is in situations where you want your application’s user interface to reflect the hierarchical nature of your content.

                  您可能需要考虑创建类别或子类化您的 UINavigationBar,并可能创建用于创建 UIBarButtonItems 的自定义 UIButtons.

                  You may want to consider creating categories or subclassing your UINavigationBar and potentially creating custom UIButtons that you use to create UIBarButtonItems.

                  每当您处理从 UIView 扩展的 UI 组件时,您应该考虑做的是子类化和覆盖

                  Whenever you deal with a UI component that extends from UIView what you should consider doing is subclassing and overriding

                  - (void)drawRect:(CGRect)rect
                  

                  stackoverflow 或 Apple 的官方文档网站上有大量示例.

                  There are plenty of examples here on stackoverflow or on Apple's official documentation site.

                  这篇关于继承 UINavigationController 的步骤的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  上一篇:将自定义按钮添加到无边框导航控制器 下一篇:在 Appdelegate 的 Storyboard 中以编程方式为 UINavigationcontroller 设置

                  相关文章

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

                    <legend id='endE0'><style id='endE0'><dir id='endE0'><q id='endE0'></q></dir></style></legend>

                    1. <tfoot id='endE0'></tfoot>
                      • <bdo id='endE0'></bdo><ul id='endE0'></ul>