Improve Performance of Grouped UITableView -
i experiencing long loading time grouped uitableview. read through other posts on topic , not able find improve performance. looking point me in right direction in re-engineering code.
there 8 sections , 32 cells. cells belong 1 of 5 different custom uitableview cell sub classes. subclasses contain subviews , put using ib.
the tableview data generated plist contains information on cell type, label , view controller link pushed uinavigationcontroller. sample of xml file shown below. complicated plist part of problem?
<dict> <key>header</key> <string>property information</string> <key>data</key> <array> <dict> <key>tableview</key> <string>informationtable</string> <key>link</key> <string>roipropertyinfouiviewcontroller</string> <key>entity</key> <string></string> <key>image name</key> <string>runtime</string> <key>cell type</key> <string>roiuitableviewcelltype3</string> <key>label</key> <string>runtime</string> </dict> </array> </dict>
another potential problem long cellforrowatindexpath
method decides class of uitableviewcell load depending on written in plist file. contributing factor?
here parsing code:
-(void)setplistfilename:(nsstring *)plist fortableview:(uitableview *)tableview if (tableview==maintableview) { nsstring *path = [[nsbundle mainbundle] pathforresource:plist oftype:@"plist"]; self.maintabledataarray = [[nsarray alloc ] initwithcontentsoffile:path]; nslog(@"count of maintablearray %d", maintabledataarray.count); }
[tableview setdatasource:self]; [tableview setdelegate:self];
[tableview setsectionfooterheight:0]; [tableview setsectionheaderheight:0];
}
here portion of cellforrowatindexpath
method:
- (uitableviewcell *)tableview:(uitableview *)tableview cellforrowatindexpath:(nsindexpath *)indexpath { nsmutablearray *tmpdataset = [[nsmutablearray alloc]init]; if (tableview==self.maintableview) { int section = [indexpath section]; tmpdataset = [[self.maintabledataarray objectatindex:section] valueforkey:@"data"]; } //**figure out cell type nsstring *celltypestring = [[tmpdataset objectatindex:[indexpath row]] valueforkey:@"cell type"]; nslog(@"cell type string %@", celltypestring); //***create different types of cells depending on listed in plist*** if ([celltypestring isequaltostring:@"roiuitableviewcelltype1"]) { roiuitableviewcelltype1 *c = [tableview dequeuereusablecellwithidentifier:celltypestring]; if(!c) { c = [[roiuitableviewcelltype1 alloc]initwithstyle:uitableviewcellstyledefault reuseidentifier:celltypestring]; } // maintableviewheight += [roiuitableviewcelltype1 retruncellheight]; nslog(@"maintableviewheight = %f", self.maintableviewheight); return [self setcellcontentfromdataarray:tmpdataset forcell:c forindexnumer:[indexpath row]];
the table contains 1 image , not load data network. advice on should spend time fixing.
Comments
Post a Comment