如何确定UINavigationController中工具栏的高

如何确定UINavigationController中工具栏的高

本文介绍了如何确定UINavigationController中工具栏的高度?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个带有UINavigationController呈现的工具栏的视图.

I have a view with a toolbar presented by a UINavigationController.

当我处理UIKeyboardWillShowNotification时,我将整个屏幕向上滚动键盘高度.问题是显示键盘时,底部的工具栏没有,所以我只需要向上滚动屏幕(keyboard.height-工具栏.height).

When I am handling UIKeyboardWillShowNotification, I'm scrolling the entire screen upwards by the height of the keyboard.The thing is when the keyboard is shown, the bottom toolbar is not, so I need to scroll the screen upwards by only (keyboard.height - toolbar.height).

但是如何获取工具栏的高度?

But how to get the height of the toolbar?

谢谢

推荐答案

您只需要检查工具栏框架即可.

You just should check the toolbar frame.

self.navigationController.toolbar.frame.size.height

当然,只有在您具有导航控制器的情况下,它才有效...

Of course, it only works if you have a navigation controller...

这篇关于如何确定UINavigationController中工具栏的高度?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-23 13:31