• <small id='tisOH'></small><noframes id='tisOH'>

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

        如何在当前 UITableViewController 上方添加一个 UIView

        时间:2023-10-03
          <tbody id='abV1B'></tbody>

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

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

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

              • <tfoot id='abV1B'></tfoot>

                  本文介绍了如何在当前 UITableViewController 上方添加一个 UIView的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  我很难从 UITableViewController 的 viewDidLoad 方法中添加子视图 (UIView)

                  I have difficulty adding a subview (UIView) from within the viewDidLoad method of a UITableViewController

                  这行得通:

                  [self.view addSubview:self.progView];
                  

                  但是你可以看到表格单元格线通过 UIView progView 流血.

                  But you can see the table cell lines bleed through the UIView progView.

                  我试过这种方法:

                  [self.view.superview insertSubview:self.progView aboveSubview:self.view];
                  

                  这是尝试将 progView、UIView 添加到当前视图上方的超级视图.当我尝试这个时,UIView 永远不会出现.

                  Which is an attempt to add the progView, UIView to the superview, above the current view. When I try this, the UIView never appears.

                  -- 更新--

                  以下是最近的尝试:

                  UIView *myProgView = (UIView *)self.progView; //progView is a method that returns a UIView
                  
                  [self.tableView insertSubview:myProgView aboveSubview:self.tableView]; 
                  [self.tableView bringSubviewToFront:myProgView];
                  

                  结果与 [self.view addSubview:self.progView] 相同;UIView 出现但似乎在表格后面.

                  Result is the same as [self.view addSubview:self.progView]; The UIView appears but seemingly behind the Table.

                  推荐答案

                  我尝试了上面的方法,但没有成功.我还发现它需要太多的配置和代码,因为它需要从头开始设置表格视图(这在故事板中很容易完成).

                  I tried the approach above, but did not get it to work. I also found it to require too much configuration and code, since it requires setting up the table view from scratch (something that is easily done from within the storyboard).

                  相反,我将想要添加到 UITableView 上方的视图添加到 UITableViewController 的 UINavigationController 的视图中,如下所示:

                  Instead, I added the view that I wanted to add above my UITableView into the UITableViewController's UINavigationController's view, as such:

                  [self.navigationController.view addSubview:<view to add above the table view>];
                  

                  这种方法需要你在 UINavigationController 中嵌入 UITableViewController,但是即使你不需要导航控制器,你仍然可以使用这种方法,只是隐藏导航栏.

                  This approach requires that you have embedded the UITableViewController in a UINavigationController, but even if you do not want a navigation controller, you can still use this approach and just hide the navigation bar.

                  这篇关于如何在当前 UITableViewController 上方添加一个 UIView的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  上一篇:如果安装了应用程序,如何以编程方式检查? 下一篇:如何检查字体是否在 iOS 版本中可用?

                  相关文章

                  <tfoot id='U3WLu'></tfoot>
                1. <legend id='U3WLu'><style id='U3WLu'><dir id='U3WLu'><q id='U3WLu'></q></dir></style></legend>

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

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

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