【发布时间】:2014-08-08 20:03:56
【问题描述】:
我在 xcode 6 beta(5) 中创建了一个自定义 UITableviewCell,但是在模拟器上测试时它看起来太小了,我尝试使用属性检查器设置宽度,但没有成功。我使用 .xib 文件创建了它,并在我的 mainViewController 中注册了它以将它与连接的 tableView 一起使用
这是模拟器中的样子
代码的单元格部分,我的自定义类名是CustomCell
var cell:CustomCell = self.tableview.dequeueReusableCellWithIdentifier("cell") as CustomCell
cell.txt.text="\(ListArray.objectAtIndex(indexPath.row))"
return cell
这就是我在 viewDidLoad 中注册的方式
var nipName=UINib(nibName: "CustomCell", bundle:nil)
self.tableview.registerClass(CustomCell.classForCoder(), forCellReuseIdentifier: "cell")
self.tableview.registerNib(nipName, forCellReuseIdentifier: "cell")
【问题讨论】:
-
有什么帮助吗?将不胜感激
标签: xcode uitableview swift