Wednesday 15 July 2015

objective c - UITableViewCell indentationLevel doesn't work in iOS 8 -



objective c - UITableViewCell indentationLevel doesn't work in iOS 8 -

i've uitableview custom uitableviewcell , utilize indentationlevel move content right. in ios 7 works fine, in ios 8 when set indentationlevel > 0 table view doesn't renderer cell , freeze interface: solution quit app. if remain in debug can notice memory used app continuously increment , cpu @ 99%.

- (uitableviewcell*)tableview:(uitableview *)tableview cellforrowatindexpath:(nsindexpath *)indexpath { static nsstring * cellidentifier = @"customcellreuseid"; treetableviewcell * cell = (treetableviewcell *)[tableview dequeuereusablecellwithidentifier:cellidentifier forindexpath:indexpath]; cell.delegate = self; foldersection * afoldersection = self.datasourcearray[indexpath.section]; foldernode * afoldernode = (foldernode *)afoldersection.foldernodes[indexpath.row]; cell.indentationwidth = 20.0f; cell.indentationlevel = afoldernode.level; // set cell homecoming cell; }

ideas ?

it seems ios > 6 lays views before methods indentation configuration called. alter code in customcell.swift this:

override func awakefromnib() { super.awakefromnib() self.indentationwidth = 30.0 self.indentationlevel = 0 } override func layoutsubviews() { super.layoutsubviews() allow indentpoints = cgfloat(self.indentationlevel) * self.indentationwidth self.contentview.frame = cgrectmake(indentpoints, self.contentview.frame.origin.y,self.contentview.frame.size.width - indentpoints,self.contentview.frame.size.height) }

to phone call them appropriately. , afterwards in cellforrowatindexpath:

... cell.indentationlevel = 1 // indentation level

ios objective-c uitableview ios8

No comments:

Post a Comment