1

enter image description here

As you can see, the layout of the separators above are not correct. The tableView is in the MoreTabController.

I found the solutions as How to fix UITableView separator on iOS 7? and this Is there a way to make UITableView cells in iOS 7 not have a line break in the separator?

But I am compiling my app against SDK 6.0 but not SDK 7.0 as my app cannot run if compiling against SDK 7.0. The function setSeparatorInset only exist after SDK 7.0, any other way I can solve this?

Community
  • 1
  • 1
Sam YC
  • 10,725
  • 19
  • 102
  • 158
  • 1
    Please read the mentioned solutions more carefully. They explicitly check whether `setSeparatorInset` is implemented: `if ([tableView respondsToSelector: @selector(setSeparatorInset:)])`. – Codo Oct 02 '13 at 07:05
  • 1
    iOS should not mess around with separators if it thinks the app is a pre-iOS 7 app. Check that *Base SDK* is set to *iOS 6* and not to *Latest iOS*. Note that *Deployment Target* is not relevant. – Codo Oct 02 '13 at 07:40
  • After thinking about it again, I think we're both on the wrong track. If you run any app in iOS 6 or in the iOS 6 mode on iOS 7 (visible by the old UI style), all separator lines have the same length, always. So it's more likely that another view with a white background covers your table view in the lower left part of the screen and makes the separator lines look like this. – Codo Oct 02 '13 at 07:55
  • @Codo Sorry, my last message was wrong. What I want to say is, my xcode is 4.5 and I am compiling against SDK 6.0. It cannot recognize `setSeparatorInset` because this function is introduced in SDK IOS 7. But for some reason, I have to compile in SDK 6.0, but run the app in IOS 7 device. Now, the layout issue happen... – Sam YC Oct 02 '13 at 07:56
  • @Codo I can perfectly got the right line alignment if I run the app in IOS 6 device, but not in IOS 7 device. – Sam YC Oct 02 '13 at 07:58
  • I just checked it with a few other iOS 6 apps on an iOS 7 device. All separator lines have the same length in iOS 6 style. I'm pretty sure it has to be something else. – Codo Oct 02 '13 at 08:08
  • @Codo I created this testing app in xcode 4.5, using UITabBarController template, and the alignment problem happens in MoreTabController after I moved the binary to a IOS 7 device. – Sam YC Oct 02 '13 at 09:13

2 Answers2

1

// in ios 7 We can set separatorInset in UITableView Two Way

1) set by Pragmatically

table.separatorInset=UIEdgeInsetsZero;

2) Or u can do this way

screen Shot

Jignesh Mayani
  • 6,937
  • 1
  • 20
  • 36
  • Don't forget to check that it's actually iOS 7 or your app will crash, for example: `if (IS_OS_7_OR_LATER) { [self.tableView setSeparatorInset:UIEdgeInsetsZero]; }` and if you need... `#define IS_OS_7_OR_LATER ([[[UIDevice currentDevice] systemVersion] floatValue] >= 7.0)` – Resty Apr 28 '14 at 10:52
0

The solution could be, set the separator style as None. Then, add an imageview or uiview (background color gray) with width as the Cell width and height 1 or 2 (depending on how thick you want the separator to be), and then add this view or image at the end of the cell. This will also help you to set your own separator color. Hope this helps.

shoan
  • 1,303
  • 15
  • 22