如何降低Uipickerview的高度? [英] How to decrease the height of the Uipickerview?

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

问题描述


可能重复:

如何更改UIPickerView高度

我正在编写一个应用程序。在该应用程序中, pickerview 高度远小于正常大小。如何减少 uipickerview 高度?

I am writing an application. In that application the pickerview height is much smaller than normal size. How do I to decrease the uipickerview height?

推荐答案

Interface Builder没有不允许你改变UIPickerView的高度(只有宽度)。视图的默认大小为320x216,但您可以通过打开父视图的xib(只是定义接口的大型XML文件)文件并查找该行来手动更改高度:

Interface Builder doesn't let you change the height of a UIPickerView (only the width). The default size of the view is 320x216 but you can change the height manually by opening the parent view's xib (just a big XML file that defines the interface) file and looking for the line:

<object class="IBUIPickerView" id="...  

然后在该XML节点中,您将看到该行(其中93是垂直y位置):

Then within that XML node you'll see the line (where 93 is the vertical y position):

<string key="NSFrame">{{0, 93}, {320, 216}}</string>  

只需将216更改为更小的东西(在我的情况下,我需要它大约为150)并重新编译!现在 - 重新打开界面构建器,您将看到界面中反映的更改!

Just change that 216 to something smaller (in my case, I needed it to be about 150) and recompile! Now - re-open Interface builder and you'll see the change reflected in your interface!

我发现,如果他们真的不想让你这样做,那么苹果公司就很难做到,但是,通常情况下这是可能的。

I've found that Apple makes things extremely difficult to do if they don't really want you doing it, however, it's usually possible.

这篇关于如何降低Uipickerview的高度?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆