swift下完成tableviewCell的注册创建

来源:互联网 发布:网络教育档案放在哪里 编辑:程序博客网 时间:2024/05/21 06:57

直接上代码

//这里是用xib创建cell的

 messageTableView.registerNib(UINib.init(nibName: "MessageCell", bundle: nil), forCellReuseIdentifier: "MessageCell")

func tableView(tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
        return 18
    }
    
    func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell {
        let cell = tableView.dequeueReusableCellWithIdentifier("MessageCell")
        
        return cell!
        
    }
    func tableView(tableView: UITableView, heightForRowAtIndexPath indexPath: NSIndexPath) -> CGFloat {
        return 70
    }


0 0