Hi I'm new to ios development. I am developing an application in which I am using UITableView
.
Tableview
contains some cells with separator line and others without separator line.
Can any one please tell me how can I remove separator line for specific cell?
cell.separatorInset = UIEdgeInsetsMake(0, 0, 0, cell.bounds.size.width);
Above code works for iOS 7
. How can I achieve this in iOS6
?
Any help is appreciated
You can just add a UIView
with the same background color as you want your separator line to be at the top of your UITableViewCell
layout, make its height one pixel (it will be the same as a line) and its width the same as your cell width (cell.frame.size.width). After this in your cellForRowAtIndexPath
just set hidden
property of this to YES
for the cell you don't want it to be shown and hidden
= NO
for those you want. It is a simple solution which will work in any iOS version. But if will add your custom separator don't forget to disable default separators for all tableview
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