Swift_ uitableview使用自定义(xib)cell
新建cell:
使用: 向 tableview 注册 nib 全局变量 letcellIdentifier ="myCell" myTableView!.registerNib(UINib(nibName:"MyCell",bundle:nil),forCellReuseIdentifier:cellIdentifier) 然后在cellForRowAtIndexPath 方法中使用: functableView(tableView:UITableView!,cellForRowAtIndexPath indexPath:NSIndexPath!) ->UITableViewCell!{ //系统cell的简单用法 //let cell = UITableViewCell(style:.Default,reuseIdentifier:"myCell") //cell.textLabel.text = "swift cell (indexPath.row)"
varmycell = tableView!.dequeueReusableCellWithIdentifier(cellIdentifier,forIndexPath: indexPath)
returnmycell } 至此,一个简单地自定义cell已经实现! (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |