ios - 静态单元格不显示在模拟器中

标签 ios objective-c xcode

这个问题在这里已经有了答案:





UITableView with static cells does not appear

(5 个回答)


5年前关闭。




我正在使用 segues,当我按下 addButton uiBarbutton 对象时,我想从一个 View 转换到另一个 View 。无论如何,我从检查器下的对象库中添加了一个表格 View 对象,我将表格的样式更改为分组并将单元格更改为静态。当我运行应用程序时,只要 TableView 对象是 UITableViewController 的子类,一切正常。当我将检查器中的表类更改为我创建的类(也是 UITableViewController 的子类)时,单元格不会像以前一样出现在模拟器中。有什么我应该添加到 prepareForSegue:sender 方法的吗?

最佳答案

当使用带有您创建的类的 TableView 以及分组样式和静态单元格时,请确保您没有实现以下内容:

  • (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView
    {
    }
  • (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
    {
    }
  • (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
    {
    }

  • 全部抹去!

    关于ios - 静态单元格不显示在模拟器中,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15204756/

    相关文章:

    ios - 如何在更改 View 的同时仍然让用户在 TextField 中进行编辑?

    ios - 蓝牙 : Advertising of UUID from background iOS app

    iOS:在 NSUserDefaults 中保存 NSMutableArray 给我一个错误: 'Attempt to insert non-property list object'?

    swift - Xcode 自动完成 : <<error type>> while project compiles

    ios - 为同一个项目编译不同的代码 - Swift 框架

    ios - 从字节中获取位的值 | swift 5

    iOS从蓝牙接收数据,然后通过wi-fi将信息发送到另一台服务器上的数据库

    ios - UIDevice.currentDevice().orientation.isLandscape 的 objective-c 等价物是什么?

    ios - uitableViewCell 的索引路径

    c++ - 如何使用 XCode 6.1 C++ Debug模式检查所有局部变量