On my main view controller is laid out a UITableView
just under the navigation bar.
In my AppDelegate
, I do some setup for the navigation bar in general as following:
UIApplication.sharedApplication().setStatusBarStyle(UIStatusBarStyle.LightContent, animated: false)
let navigationBarAppearace = UINavigationBar.appearance()
navigationBarAppearace.tintColor = UIColor.whiteColor()
navigationBarAppearace.barStyle = .Black
navigationBarAppearace.titleTextAttributes = [NSForegroundColorAttributeName:UIColor.whiteColor()]
With this setup, when I call this on my first cell of my table view in my main view controller
let cellFrame = tableView.convertRect(cell.frame, toView: tableView.superview)
I get the following frame
:
cellFrame : (0.0, 64.0, 375.0, 268.0)
Which is what I expect to get. Then, when I add the following in my setup in my AppDelegate
:
navigationBarAppearace.translucent = false
then I get the following frame
:
cellFrame : (0.0, 0.0, 375.0, 268.0)
The y origin is now 0.
Can someone explain me why?