0
我正在使用RATreeView的項目中工作。我已經成功執行它 。但我的問題是,當我展開細胞我的孩子細胞沒有正常顯示在第一時間。第二次點擊後,它顯示完美。RATreeView的擴展子視圖位置
請訪問this瞭解更多創意。
這裏是我的自定義的tableview細胞
func setup(title: String, icon: UIImage, level : Int,isChild:Bool) {
self.title.text = title
self.icon.image = icon
if isChild{
let left = 50.0 + 20.0 * CGFloat(level)
let tFrame = self.title.frame
let iFrame = self.icon.frame
self.title.frame = CGRectMake(left, tFrame.origin.y, tFrame.width, tFrame.height)
self.icon.frame = CGRectMake(left-25, iFrame.origin.y, iFrame.width, iFrame.height)
}
}
代碼這裏是代碼爲每個小區
func treeView(treeView: RATreeView, cellForItem item: AnyObject?) -> UITableViewCell {
let cell = treeView.dequeueReusableCellWithIdentifier("TreeCell") as! TreeTableViewCell
let item = item as! ExpandableItems
let level = treeView.levelForCell(cell)
cell.setup(item.name, icon: item.icon!, level: level,isChild: item.isChildren)
return cell
}
請幫助我。我也想改變單元的默認選擇顏色。