ios - 如何在表格 View 中添加三个表格 View 单元格作为 subview ?

标签 ios swift parse-platform tableview uitableview

我想添加 2 个单元格,一个作为前一个表格 View 的标题,第二个单元格用于详细信息,例如这个原型(prototype)。

第一个 Cell 类“courseCell” 第二单元类“DetailsTVC”

找了很多方法都行不通,希望有人帮忙

I couldn't follow with this instruction
Initialize your custom tableviewcell - CustomCell1 and CustomCell2
Since tableviewcell is a subclass of UIView you can add it as a subview.
  [TableCell addSubview:CustomCell1];
          [TableCell addSubview:CustomCell2];
          cell?.addSubview(<#view: UIView>)
         [cell ?.addSubview(<#view: UIView>)]

enter image description here

override func tableView(tableView: UITableView!, cellForRowAtIndexPath indexPath: NSIndexPath!, object: PFObject!) -> PFTableViewCell {

    var cell = tableView.dequeueReusableCellWithIdentifier("cell" , forIndexPath : indexPath) as? courseCell


    if cell == nil
    {
        cell = courseCell(style: UITableViewCellStyle.Default, reuseIdentifier: "cell")
    }

    cell?.name.text = object["title"] as! String!
    cell?.location.text = object["Location"] as! String!






    return cell!
}

最佳答案

完成它:

TableViewController
 - Tableview
   - TableViewHeader (create a UIView subclass for this view)
   - TableViewContent (datasource)
     - TableViewCell1 (virgin american fligth ...)
     - TableViewCell1 (departs los angeles)
     - TableViewCell1 (arrives new york)

请注意,您的 tableviewController 不需要 XIB 文件

关于ios - 如何在表格 View 中添加三个表格 View 单元格作为 subview ?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29216184/

相关文章:

ios - 如何将解析对象字段从一个类发送到另一个类?

ios - 无法在测试中将 App Delegate 转换为 App Delegate

ios - 如何切换到MainThread来访问Realm对象

ios - SwiftUI 的 TabView 颜色无法更改为自定义颜色

ios - 如何将图像从 AWS S3 加载到 UICollectionView 中?

ios - 如何让我的投票系统代码与 Parse 一起使用?

ios - tableView 数据源的字典

ios - 如何从 Cordova 插件添加 native View

ios - 快速使用 Spotify SDK 的编译器错误

ios - 无法使用 prepare for segue 方法执行 segue