ios - UITableViewCell disclosure indicator disappears on scrolling -
i have custom tableviewcell subviews defined in prototype cell in storyboard. in storyboard set accessory disclosure indicator, when scrolling (when cells reused) indicator disappears.
i tried set in code:
- (uitableviewcell *)tableview:(uitableview *)tableview cellforrowatindexpath:(nsindexpath *)indexpath { ... cell.accessorytype = uitableviewcellaccessorydisclosureindicator;
it did not work well. found working solution, weird solution:
- (uitableviewcell *)tableview:(uitableview *)tableview cellforrowatindexpath:(nsindexpath *)indexpath { ... cell.accessorytype = uitableviewcellaccessorynone; cell.accessorytype = uitableviewcellaccessorydisclosureindicator;
i don't know why can fix anything, works me. can tell me why or if there other problem/fix?
update:
how reusable cell:
activityweekcell *cell = [tableview dequeuereusablecellwithidentifier:@"cell" forindexpath:indexpath];
i tried:
activityweekcell *cell = [tableview dequeuereusablecellwithidentifier:@"cell" forindexpath:indexpath]; if (cell == nil) { cell = [[activityweekcell alloc] initwithstyle:uitableviewcellstyledefault reuseidentifier:@"cell"]; cell.accessorytype = uitableviewcellaccessorydisclosureindicator; }
try use variant:
activityweekcell *cell = [tableview dequeuereusablecellwithidentifier:@"cell" forindexpath:indexpath]; if (cell == nil) { cell = [[activityweekcell alloc] initwithstyle:uitableviewcellstyledefault reuseidentifier:@"cell"]; } cell.accessorytype = uitableviewcellaccessorydisclosureindicator;
Comments
Post a Comment