zoukankan      html  css  js  c++  java
  • iOS: 在UIViewController 中添加Static UITableView

    如果你直接在 UIViewController 中加入一个 UITableView 并将其 Content 属性设置为 Static Cells,此时 Xcode 会报错:
    Static table views are only valid when embedded in UITableViewController instances.
     
     
    意思是说,如果 UITableView 不是在 UITableViewController 而是在 UIViewController 中的时候,是不允许将 UITableView 的 Content 属性设置为 Static Cells 的。
     
    但是,如果想让 UIViewController 中的 UITableView 是一个 Static Cells 的怎么办呢?
     
    方法是有的!既使用Container View在中间连接一下。
    步骤如下:
    1. 先将 TableView 放到一个 UITableViewController 中,
    2. 然后在原来的 UITableViewController 加入一个 ContainerView,
    3. 最后连接 ContainerView 和 UITableViewController。
     

    效果:

     


    相关源代码:GitHub

  • 相关阅读:
    货币系统
    纸牌
    活动
    KKT-黑白球
    POJ2676-Sudoku
    POJ1717-Dominoes
    POJ1088-滑雪
    POJ1862-Stripies
    POJ2531-Network Saboteur
    2019.12.13 数的划分
  • 原文地址:https://www.cnblogs.com/sirkevin/p/4190114.html
Copyright © 2011-2022 走看看