博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
iOS: 在UIViewController 中添加Static UITableView
阅读量:4674 次
发布时间:2019-06-09

本文共 593 字,大约阅读时间需要 1 分钟。

如果你直接在 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。
 

 

效果:

 

相关源代码:

转载于:https://www.cnblogs.com/sirkevin/p/4190114.html

你可能感兴趣的文章
Spring之@Configuration配置解析
查看>>
Windows操作系统远程Linux服务器传输文件方法(以EasyDSS云平台、EasyNVR上传部署为例)...
查看>>
pip安装第三方库以及版本
查看>>
VS2010中dumpbin工具的使用
查看>>
使用Golang搭建web服务
查看>>
HTML5触摸事件(touchstart、touchmove和touchend)
查看>>
架构师软技能之协商(上)
查看>>
商品翻牌效果(纯css)
查看>>
win10 UWP 序列化
查看>>
web之JavaScript
查看>>
连续子数组的最大和(基于动态规划)
查看>>
HTTPS配置
查看>>
20155220 2016-2017-2《Java程序设计》第五周学习总结
查看>>
git回滚远程仓库
查看>>
C#/Net的语法和一些小技巧笔记
查看>>
Xcode 4.2 中的Automatic Reference Counting (ARC) (转)
查看>>
HTTP Status 500 - An exception occurred processing JSP page /WEB-INF
查看>>
IntelliJ IDEA 2018 设置代码提示对大小写不敏感
查看>>
MySQL备份mydumper的原理【转】
查看>>
win8安装wampserver报403错误解决方法
查看>>