菜鸟教程小白 发表于 2022-12-11 19:17:24

ios - 以编程方式更改 UITabBarController 选项卡 Bar 属性的类


                                            <p><div>
            <aside class="s-notice s-notice__info post-notice js-post-notice mb16"role="status">
      <div class="d-flex fd-column fw-nowrap">
            <div class="d-flex fw-nowrap">
                <div class="flex--item wmn0 fl1 lh-lg">
                  <div class="flex--item fl1 lh-lg">
                        <b>这个问题在这里已经有了答案</b>:
                        
                  <br><hr><h1><strong>Best Answer-推荐答案</ strong></h1><br>
                                            <p><p>我不确定 <code>Objective-C</code> 但在 <code>Swift</code> 中,您可以通过将 <code>tabBar</code> 重写为 <a href="https://developer.apple.com/library/content/documentation/Swift/Conceptual/Swift_Programming_Language/Properties.html#//apple_ref/doc/uid/TP40014097-CH14-ID259" rel="noreferrer noopener nofollow">computed property</a> 来做到这一点:</p>

<pre><code>open class MyTabBarController: UITabBarController {
    open override var tabBar: MyTabBar {
      return MyTabBar()
    }
}
</code></pre></p>
                                   
                                                <p style="font-size: 20px;">关于ios - 以编程方式更改 UITabBarController 选项卡 Bar 属性的类,我们在Stack Overflow上找到一个类似的问题:
                                                        <a href="https://stackoverflow.com/questions/42851900/" rel="noreferrer noopener nofollow" style="color: red;">
                                                                https://stackoverflow.com/questions/42851900/
                                                        </a>
                                                </p>
                                       
页: [1]
查看完整版本: ios - 以编程方式更改 UITabBarController 选项卡 Bar 属性的类