简体   繁体   English

UITableViewController 之外的静态表格视图

[英]Static table view outside UITableViewController

After the new Xcode update, my app doesn't validate and shows this error:新的 Xcode 更新后,我的应用程序未验证并显示此错误:

static table views are only valid when embedded in UITableViewController instances静态表视图仅在嵌入到 UITableViewController 实例中时才有效

Any chances to solve easily?有机会轻松解决吗?

The only way to get a static UITableView along with other controls on the same screen is to use a Container View.在同一屏幕上获得静态 UITableView 和其他控件的唯一方法是使用容器视图。 Follow this way, it works perfectly:按照这种方式,它完美地工作:

  1. Drag a ViewController onto your storyboard.将 ViewController 拖到故事板上。
  2. Drag a TableViewController onto your storyboard.将 TableViewController 拖到故事板上。
  3. Next Drag a Container view to your ViewController and size it about the size you want (smaller than the view) -> when you drag the container view it will create a segue and another view.接下来将一个容器视图拖到您的 ViewController 并将其调整为您想要的大小(小于视图)-> 当您拖动容器视图时,它将创建一个 segue 和另一个视图。 Remove that segue and view.删除该 segue 并查看。
  4. Then finally ctrl click in your container and drag to your new TableViewContoller.然后最后 ctrl 单击您的容器并拖动到您的新 TableViewContoller。 Select Embed.选择嵌入。
  5. Style your TableView the way you want -> including static cells.按照您想要的方式设置 TableView 样式 -> 包括静态单元格。

Good luck.祝你好运。

This answer was already found and given here: G.Huebner -> http://web.archive.org/web/20140928102504/http://iphonedevsdk.com/forum/iphone-sdk-development/111800-static-table-view-cells-only-work-in-a-uitableviewcontroller.html这个答案已经在这里找到并给出:G.Huebner -> http://web.archive.org/web/20140928102504/http://iphonedevsdk.com/forum/iphone-sdk-development/111800-static-table- view-cells-only-work-in-a-uitableviewcontroller.html

A static UITableView must be in a UITableViewController.静态 UITableView 必须在 UITableViewController 中。 So you will have place the table in UITableViewController and then add it as childView to the MainViewController.所以你将把表放在 UITableViewController 中,然后将它作为 childView 添加到 MainViewController。

You can refer https://iphoneidoit.blogspot.in/2013/10/static-uitableview-in-uiviewcontroller.html你可以参考https://iphoneidoit.blogspot.in/2013/10/static-uitableview-in-uiviewcontroller.html

I think what you are doing is you are first dragging the ViewController on the storyboard and then dragging the tableView on the ViewController.我认为您正在做的是首先在情节提要上拖动 ViewController,然后在 ViewController 上拖动 tableView。 In this way you can't use the Static table cells.这样你就不能使用静态表格单元格。 Instead of this what you should have done is Drag the TableViewController on the main storyboard instead of a ViewController and then select the static cells.而不是你应该做的是在主故事板上拖动 TableViewController 而不是 ViewController,然后选择静态单元格。 In this way you can be able to work on static cells and can use any elements on static cells.通过这种方式,您可以处理静态单元格并可以使用静态单元格上的任何元素。

好吧,如果您真的在使用静态 tableView,则应该考虑将所有内容复制/粘贴到 ScrollView 或 StackView。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 在UITableViewController iOS中实现另一个表视图 - Implementing another table view in a UITableViewController ios 内置表格视图的UITableViewController和UIViewController之间切换 - Switching between UITableViewController and UIViewController with table view inside 在窗口中将 UITableViewController 的 UIActivityIndi​​catorView 居中,而不是在表视图中 - Center a UIActivityIndicatorView for a UITableViewController in the window, not in the table view UITableViewController中的节标题和表格视图单元的问题 - Issue with section header and table view cell in UITableViewController 将浮动视图(即静态和固定)添加到UITableViewController - Add floating view (i.e. static and fixed) to UITableViewController 是否可以使用故事板使用UIViewController而不是UITableViewController创建静态表? - Is it possible to use storyboards to create a static table using UIViewController instead of UITableViewController? 在UITableViewController外部使用NSFetchedResultsController - Using NSFetchedResultsController outside of a UITableViewController UITableViewController - 下拉表视图以显示新的UIView - UITableViewController - Drop down table view to show a new UIView 在UITableViewController内的表视图中添加左右边距 - Adding left and right margins to a table view inside UITableViewController UITableViewController中的UISearchController-Rows不可选,表视图显示为灰色 - UISearchController in a UITableViewController—Rows not selectable and table view is greyed out
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM