Static table views are only valid when embedded in

Table of Contents

    问题 当在UIViewController中加入Table View,然后将其Content设置为Static Cells,xcode编译时报错提示:Static table views are only valid when embedded in UITableViewController instances。

    解决方法

    1. 将放置Table View改为放置Container View;

    2. 单独拖出一个Table View Controller,在这里就可以将Table View的Content设置为Static Cells做你想做的事情;

    3. 关联,在Container View上按住右键拖出一条线到Table View Controller释放鼠标右键弹出如下窗口,选择Embed,这样就大功告成了。 这里写图片描述