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

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

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

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

        在 UINavigationController 的 UINavigationBar 内部或顶部显示 UIProgres

        Showing a UIProgressView inside or on top of a UINavigationController#39;s UINavigationBar(在 UINavigationController 的 UINavigationBar 内部或顶部显示 UIProgressView)

        <legend id='528cM'><style id='528cM'><dir id='528cM'><q id='528cM'></q></dir></style></legend>
      2. <small id='528cM'></small><noframes id='528cM'>

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

                • <bdo id='528cM'></bdo><ul id='528cM'></ul>
                • 本文介绍了在 UINavigationController 的 UINavigationBar 内部或顶部显示 UIProgressView的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  我想要一个 UIProgressView 在导航栏底部显示进度(就像在 iOS 7 中发送 iMessage 或文本消息时一样).但是我在导航控制器的每个表视图视图上都需要这个.所以对我来说很清楚:我必须将它添加到 UINavigationController.但问题是,无法将 UIProgressView 添加到 UINavigationController.所以我尝试了两件事:

                  I want to have an UIProgressView to show a progress on the bottom of a navigation bar (just like when sending an iMessage or text message in iOS 7). But I need this consistently on every table view view of my navigation controller. So for me it was clear: I have to add this to the UINavigationController. But the problem is, it's not possible to add an UIProgressView to the UINavigationController. So I tried out two things:

                  第一次我尝试以编程方式将它添加到 UINavigationController 的视图中.但问题是定位 UIProgressView 并使其在更改设备旋转时看起来不错.

                  1st I tried to add it to UINavigationController's view programmatically. But the problem was to position the UIProgressView and to make it look good when changing device rotation.

                  我尝试的第二件事是将 UIProgressView 添加到每个 UITableView,但是我真的必须为每个视图都这样做.它看起来也不好看,因为它不在导航栏的顶部,而是在它的下方.但我不喜欢第二种解决方案的主要原因是,ProgressViews 随他们的 TableView 一起出现,所以你没有静态的,而是变化的.

                  The 2nd thing I tried is to add the UIProgressView to every UITableView, but then I really have to do this for every view. Also it doesn't look good, because it is not on top of the navigation bar but beneath it. But the main reason why I didn't like the 2nd solution is because the ProgressViews go and come with their TableView, so you don't have a static one but changing ones.

                  在这之后,我没有任何想法这样做,所以我问你......有人知道如何做到这一点吗?

                  After this, I don't have any idea to do this, so I ask you… does anyone have an idea how to do this?

                  它应该是这样的:

                  推荐答案

                  终于找到了解决办法:

                  我制作了一个自定义 UINavigationController 并将其添加到 viewDidLoad

                  I made a custom UINavigationController and added this to viewDidLoad

                  - (void)viewDidLoad
                  {
                      [super viewDidLoad];
                      // Do any additional setup after loading the view.
                  
                      progress = [[UIProgressView alloc] init];
                  
                      [[self view] addSubview:progress];
                  
                      UIView *navBar = [self navigationBar];
                  
                  
                      [[self view] addConstraints:[NSLayoutConstraint constraintsWithVisualFormat:@"V:[navBar]-[progress(2@20)]"
                                                                                          options:NSLayoutFormatDirectionLeadingToTrailing
                                                                                          metrics:nil
                                                                                            views:NSDictionaryOfVariableBindings(progress, navBar)]];
                  
                      [[self view] addConstraints:[NSLayoutConstraint constraintsWithVisualFormat:@"H:|[progress]|"
                                                                                          options:NSLayoutFormatDirectionLeadingToTrailing
                                                                                          metrics:nil
                                                                                            views:NSDictionaryOfVariableBindings(progress)]];
                  
                      [progress setTranslatesAutoresizingMaskIntoConstraints:NO];
                  
                      [progress setProgress:0 animated:NO];
                  }
                  

                  我创建了一个新的 UIProgressView(我在 @interface 中声明)添加了约束以将其定位在导航栏下方并且(这一步很重要:)将 translatesAutoresizingMaskIntoConstraints 设置为.

                  I created a new UIProgressView (I declared in @interface) added the constraints to position it beneath the navigation bar and (this step is important:) set translatesAutoresizingMaskIntoConstraints to NO.

                  这篇关于在 UINavigationController 的 UINavigationBar 内部或顶部显示 UIProgressView的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

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

                  相关文档推荐

                  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 add a navigation controller programmatically in code but not as initial view controller(如何在代码中以编程方式添加导航控制器,但不作为初始视图控制器)
                  The correct way to set a light status bar text color in iOS 7 based on different ViewControllers(iOS 7中基于不同ViewControllers设置灯光状态栏文字颜色的正确方法)
                  View being blocked by UITransitionView after being presented(呈现后被 UITransitionView 阻止的视图)
                  • <bdo id='k6AZw'></bdo><ul id='k6AZw'></ul>

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

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

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