ios - Laggy UITableViewController -
i have uitableviewcontroller
1000 row. each cell contains label fill attributed string. cell self sizing cell , estimation not correct in estimatedheightforrowatindexpath
did not use (i don't no why estimation cause lag, use nssting.boundingrectwithsize
estimation). have uislider
seekbar in bottom of view, when seek middle of page main thread become busy cellforrowatindexpath
, not show waiting progress bar hud progress.
here cellforrowatindexpath
:
func tableview(tableview: uitableview, cellforrowatindexpath indexpath: nsindexpath) -> uitableviewcell { let cell = tableview.dequeuereusablecellwithidentifier("aya cell") as! ayacell let detail = api.readingdetail[indexpath.row % api.readingdetail.count] cell.backgroundcolor = backgroundcolor switch detail { case .persian: let text = translations.suras[self.sura.index-1].ayas[indexpath.row / api.readingdetail.count].text var textbackground = uicolor.clearcolor() if translations.suras[self.sura.index-1].ayas[indexpath.row / api.readingdetail.count].shouldselected == true { textbackground = uicolor.yellowcolor() } let attributedtext = nsmutableattributedstring(string: text, attributes: [nsforegroundcolorattributename: persiantextcolor, nsfontattributename: ayapersianfont!, nsbackgroundcolorattributename: backgroundcolor]) attributedtext.appendattributedstring(nsattributedstring(string: " (\((indexpath.row / api.readingdetail.count+1).toarabicdigit()))", attributes: [nsforegroundcolorattributename: mojezeredcolor, nsfontattributename:uifont(name: "xnazanin", size: ayafont!.pointsize*0.65)!, nsparagraphstyleattributename: ayaparagraphstyle])) cell.ayatextlabel.attributedtext = attributedtext case .arabic: let text = self.sura.ayas[indexpath.row / api.readingdetail.count].text var textbackground = uicolor.clearcolor() if self.sura.ayas[indexpath.row / api.readingdetail.count].shouldselected == true { textbackground = uicolor.yellowcolor() } let attributedtext = nsmutableattributedstring(string: text, attributes: [nsforegroundcolorattributename: arabictextcolor, nsfontattributename: ayafont!, nsbackgroundcolorattributename: textbackground]) attributedtext.appendattributedstring(nsattributedstring(string: " ﴿\((indexpath.row / api.readingdetail.count+1).toarabicdigit())﴾", attributes: [nsforegroundcolorattributename: mojezeredcolor, nsfontattributename:uifont(name: "xnazanin", size: ayafont!.pointsize*0.65)!, nsparagraphstyleattributename: ayaparagraphstyle])) cell.ayatextlabel.attributedtext = attributedtext } return cell }
is there solution this?
Comments
Post a Comment