现在的位置: 首页 > 综合 > 正文

深入浅出Swift(4)—— TableView

2018年02月02日 ⁄ 综合 ⁄ 共 706字 ⁄ 字号 评论关闭
    func tableView(tableView: UITableView, numberOfRowsInSection section: Int) -> Int{
        return 10
    }
    
    
    func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell{
        let cell: UITableViewCell = UITableViewCell(style: UITableViewCellStyle.Subtitle, reuseIdentifier: "cell")
        cell.textLabel?.text="hello";
        return cell
    }
    
    func tableView(tableView: UITableView, didSelectRowAtIndexPath indexPath: NSIndexPath){
        tableView.deselectRowAtIndexPath(indexPath, animated: true)
        
    }

    func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell{
        let cellIdentifier: String = "zzCell"
        var cell: zzCell? = NSBundle.mainBundle().loadNibNamed(cellIdentifier, owner: self, options: nil).last as? zzCell;
        return cell!
    }

抱歉!评论已关闭.