ios - Getting EXC_Bad_Access while scrolling tableview -
i getting exc_badaccess error message while scrolling tableview.
the following code have done in cellforrowatindexpath.
- (uitableviewcell *)tableview:(uitableview *)tableview cellforrowatindexpath:(nsindexpath *)indexpath { static nsstring *cellidentifier=@"customcellhistory"; customcellhistory *cell=(customcellhistory*)[tableview dequeuereusablecellwithidentifier:cellidentifier]; if (cell == nil) { nsarray *toplevelobjects=[[nsbundle mainbundle]loadnibnamed:@"customcellhistory" owner:self options:nil]; (id currentobject in toplevelobjects) { if ([currentobject iskindofclass:[uitableviewcell class]] ) { cell=(customcellhistory*)currentobject; break; } } } cell.lb11.text=[cellarray1 objectatindex:indexpath.row]; cell.lbl2.text=[cellarray2 objectatindex:indexpath.row]; return cell; }
i can sense problem arising due mistake in above code.
i used customcell in above code display customized cell.
can tell me wrong have done in code
hey try following code, dont forget set cell identifier
in custom xib customcellhistory
at top
#import "customecellhistory.h"
then
- (uitableviewcell *)tableview:(uitableview *)tableview cellforrowatindexpath:(nsindexpath *)indexpath { static nsstring *cellidentifier = @"customcellhistory"; customcellhistory *cell = (customcellhistory *)[tableview dequeuereusablecellwithidentifier:cellidentifier]; if (cell == nil) { nsarray *nib = [[nsbundle mainbundle] loadnibnamed:@"customcellhistory" owner:self options:nil]; cell = [nib objectatindex:0]; } cell.lb11.text=[cellarray1 objectatindex:indexpath.row]; cell.lbl2.text=[cellarray2 objectatindex:indexpath.row]; return cell; }
Comments
Post a Comment