Swift3.0使用UITableViewCell.Xib

来源:互联网 发布:ib网络 跟以太网区别 编辑:程序博客网 时间:2024/05/17 16:02

let tableView = UITableView(frame: .zero, style: .plain)


view.addSubview(tableView)


        tableView.delegate   =self

        tableView.dataSource =self

        tableView.separatorInset =UIEdgeInsetsMake(0,10,0, 10)


        let superview =self

        

        tableView.mas_makeConstraints { makein

            let_ = make?.edges.equalTo()(superview.view)

        }



1.Xib中Identifier名字一致

var receiverIdentifier    = "ReceiverListCell"

2.

let requesterNib = UINib(nibName:"ReceiverListCell", bundle:nil)

        tableView.register(requesterNib, forCellReuseIdentifier:receiverIdentifier)

3.

let cell:ReceiverListCell?  =tableView.dequeueReusableCell(withIdentifier:receiverIdentifier) as? ReceiverListCell

0 0