ios - Delay in UITableViewCell touch response -
i trying implement 'settings page' split view table view on left , image view on right. fine there delay in table view cell touch if try tap faster. didselectrowatindex
path not getting called cell blinks.
what i've tried,
moved image changing logic
willselectrowatindexpath
didselectrowatindex
removed delegate methods (to check whether due loading of image)
how can solve wired problem?
tabledatasource
- (uitableviewcell *)tableview:(uitableview *)tableview cellforrowatindexpath:(nsindexpath *)indexpath { static nsstring *cellidentifier = @"tutorialcell"; customtableviewcell *cell = [tableview dequeuereusablecellwithidentifier:cellidentifier]; if (cell == nil) { nsarray *nib = [[nsbundle mainbundle] loadnibnamed:@"tutorialtablecell" owner:nil options:nil]; cell = [nib objectatindex:0]; } nsdictionary * dic = [dictarray objectatindex:indexpath.row]; cell.tutorialtext.text = [dic valueforkey:tutorial_text]; cell.tutorialimage.image = [uiimage imagenamed:[dic valueforkey:tutorial_icon]]; cell.contentview.backgroundcolor = [uicolor colorwithhex:@"#36393d" alpha:1.0]; uiview *bgcolorview = [[uiview alloc] init]; [bgcolorview setbackgroundcolor:[uicolor colorwithhex:@"#1f1f1f" alpha:1.0]]; [cell setselectedbackgroundview:bgcolorview]; return cell; }
tableview delegate
- (void)tableview:(uitableview *)tableview didselectrowatindexpath:(nsindexpath *)indexpath { nsdictionary * dic = [dictarray objectatindex:indexpath.row]; _tutorialimageview.image = [uiimage imagenamed:[dic valueforkey:tutorial_image]]; }
uitableviews subclasses of uiscrollviews have delayscontenttouches
enabled default. because uiscrollview tries figure out if touch part of swipe gesture or scrolling action before allowing touch go subviews. if want disable action can, setting delayscontenttouches
of table view no. might make scrolling behave little strangely because taps immediately go table view's cells. might find delayed touch action better non-delayed touch action.
edit clement says tried that, here's idea.
in posted code you're loading these images disk (imagenamed:
) @ least initially. uikit might caching. if tutorial images pretty big there might not can load them faster, load them ahead of time instead. can load images , put them in dictionary using same [dic valueforkey:tutorial_image]
keys. in tableview:didselectrowatindexpath:
can set _tutorialimageview.image
1 of (already loaded) images dictionary.
Comments
Post a Comment