I have a problem with the styling of a UITableView
in a UIViewController
when presented modally on iPad inside of a UINavigationController
. Very simply, I want the table cell border to not appear and so in IB I set the Separator Style to 'None' and the Separator Color to 'Clear Color'. In the NIB my grouped table looks the way I want it to look:
In the NIB the tableView is hooked to the File's Owner for it's source and delegate. It is also set as an IBOutlet. The File's Owner's class name is properly set to the VC that I want loading this NIB. On start up I create an instance of this VC, then I create an instance of a UINavigationController
. I init the UINavigationController
with this VC (that has the UITableView
) and then present the UINavigationController
modally. On iPad I present it with the modal form sheet presentation style.
In my AppDelegate's application:didFinishLaunchingWithOptions:
method I instantiate and retain a reference to both the VC and it's parent `UINavigationController:
self.loginViewController = [[LoginViewController alloc] initWithNibName:@"LoginViewController" bundle:nil];
self.loginViewNavigationController = [[UINavigationController alloc] initWithRootViewController:self.loginViewController];
Then ... after some logic has been performed (still in the AppDelegate) I present the UINavigationController
modally:
if (self.loginViewNavigationController != nil) {
if ([UIDevice currentDevice].userInterfaceIdiom == UIUserInterfaceIdiomPad)
self.loginViewNavigationController.modalPresentationStyle = UIModalPresentationFormSheet;
[self.window.rootViewController presentViewController:self.loginViewNavigationController animated:YES completion:nil];
}
All is well with the world on iPhone, in that my cell border is not visible:
However, on iPad the cell border is clearly visible and my navigation header styling is all gone (that's a problem for another day):
I'd really like to know why the UITableView
ignores the separator style like this on iPad. I've tried setting the modalPresentationStyle
to PageSheet and FullScreen and have the same issue. I've also tried setting these properties in the VC's viewDidLoad
(that contains the table view) to no avail. I have also tried creating an iPad specific NIB "LoginViewController~ipad" and hooking everything up that way but that didn't seem to make a difference either.
It could be the way I'm retaining the login VC and it's containing UINavigationController
, but I can't be sure because this works just fine on iPhone.
I'm guessing this probably has something to do with the modal presentation on iPad and for all my searching and trying different combinations I can't figure out what's going on. Any ideas?
[EDIT]
I'm working in the simulator with iOS 6.1, 5.1 and 5.0. I see the same issue in all versions. I'm sticking with iOS 6.1 for now and will move backwards to be compatible. I haven't yet moved to a device.
Thanks!
As it turns out I had some faulty styling code in my UINavigationController subclass (bad, I know?) that was not properly styling the navigationBar and table. I've since fixed the issue and now the UINavigationController looks like it should.