Ios UITableViewCell.frame';当导航栏半透明设置为false时,s y原点等于0
在我的主视图控制器上,在导航栏下方放置了一个Ios UITableViewCell.frame';当导航栏半透明设置为false时,s y原点等于0,ios,swift,uitableview,Ios,Swift,Uitableview,在我的主视图控制器上,在导航栏下方放置了一个UITableView 在myAppDelegate中,我通常对导航栏进行如下设置: UIApplication.sharedApplication().setStatusBarStyle(UIStatusBarStyle.LightContent, animated: false) let navigationBarAppearace = UINavigationBar.appearance() navigationBarAppearace.ti
UITableView
在myAppDelegate
中,我通常对导航栏进行如下设置:
UIApplication.sharedApplication().setStatusBarStyle(UIStatusBarStyle.LightContent, animated: false)
let navigationBarAppearace = UINavigationBar.appearance()
navigationBarAppearace.tintColor = UIColor.whiteColor()
navigationBarAppearace.barStyle = .Black
navigationBarAppearace.titleTextAttributes = [NSForegroundColorAttributeName:UIColor.whiteColor()]
使用此设置,当我在主视图控制器中的表视图的第一个单元格上调用此设置时
let cellFrame = tableView.convertRect(cell.frame, toView: tableView.superview)
我得到以下帧
:
cellFrame : (0.0, 64.0, 375.0, 268.0)
cellFrame : (0.0, 0.0, 375.0, 268.0)
这就是我期望得到的。然后,当我在我的AppDelegate
中的设置中添加以下内容时:
navigationBarAppearace.translucent = false
然后我得到以下帧
:
cellFrame : (0.0, 64.0, 375.0, 268.0)
cellFrame : (0.0, 0.0, 375.0, 268.0)
y原点现在为0
有人能解释一下为什么吗[可能对你有帮助。我试过了,但没有成功。我的
tableView.frame.minY
仍然等于0我很糟糕,我没有尝试所有的可能性。在视图中执行self.extendedLayoutCludeSopaqueBars=true
我的主视图控制器的加载修复了它。这很奇怪,因为他们在文档中说相反:如果你的设计使用不透明条,请参考通过同时将ExtendedLayoutCludeSopaqueBars属性设置为NO来生成edgesForExtendedLayout[可能对你有帮助。我试过了,但没有成功。我的tableView.frame.minY
仍然等于0我很糟糕,我没有尝试所有的可能性。在视图中执行self.extendedLayoutCludeSopaqueBars=true
我的主视图控制器的加载修复了它。这很奇怪,因为他们在文档中说相反:如果你的设计使用不透明条,请参考通过同时将ExtendedLayoutCludeSopaqueBars属性设置为NO来生成edgesForExtendedLayout