I have a problem in iOS 7 with UITableView
(style: UITableViewStyleGrouped
) and separatorInset
. At times, the separator is not visible.
Briefly, using the same table (exactly the same code) if I render the table loading directly all data (for example from a NSArray
), separator lines are correct (default iOS7 style, correct inset value). If I dynamically add new rows to the same table using something like insertRowsAtIndexPaths, separator lines span the full width of the cell/screen (so, no iOS7 default style).
I tried to force 'separatorInset' using setSeparatorInset
in both UITableView
and in every single cell but this did not worked. If I reloadData
after adding a new row, the separator lines are correctly shown.but this seems not a great solution.
Any ideas why separator is intermittently not visible?
Write this code in your ViewDidLoad
method :
[tblView setSeparatorInset:UIEdgeInsetsZero];
For me the only things working is reload the previous cell, i.e. the one that is on top of the selected cell.
if (indexPath.row > 0) {
NSIndexPath *path = [NSIndexPath indexPathForRow:indexPath.row - 1 inSection:indexPath.section];
[tableView reloadRowsAtIndexPaths:@[path] withRowAnimation:UITableViewRowAnimationNone];
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With