我发现UITabBar的高度是49px(或50px,取决于来源)。
I've found out that the height of a UITabBar is 49px (or 50px, depending on the source).
因为我不喜欢使用它我的代码中有很多硬编码的值我想知道是否可以通过编程方式检索tabbar的高度。
Because I don't like to use too much hard-coded values in my code I was wondering if it is possible to retrieve the height of the tabbar programmatically.
亲切的问候, Niels R.
Kind regards, Niels R.
PS:我问的原因是因为我有一个视图控制器(带有包含文本字段的列表视图),它只是由navigationcontroller推送( pushViewController)或呈现为模态(presentModalViewController)。一旦键盘出现,视图的大小就会减小,但我必须考虑到只有在按下视图控制器时才能看到标签栏,而不是以模态显示。
PS: The reason I'm asking is because I have a view controller (with a list view containing text fields) that is either simply pushed by the navigationcontroller (pushViewController) or presented as a modal (presentModalViewController). As soon as the keyboard show up, the size of the view is reduced, but I have to take into account that the tabbar is only visible when the view controller is pushed and not presented as a modal.
推荐答案我不完全理解您的PS,但您可以这样做:
I don't totally understand your P.S., but you can do:
tabBarController?.tabBar.frame.size.height更多推荐
如何以编程方式获取tabbar的高度?
发布评论