如何更改 UIPickerView 高度 [英] How to change UIPickerView height

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

问题描述

UIPickerView 的高度可以改变吗?某些应用程序似乎具有较短的 PickerViews,但设置较小的框架似乎不起作用,并且框架在 Interface Builder 中被锁定.

Is it possible to change the height of UIPickerView? Some applications seem to have shorter PickerViews but setting a smaller frame doesn't seem to work and the frame is locked in Interface Builder.

推荐答案

很明显,Apple 并没有特别邀请 UIPickerView 的默认高度,但我发现你可以通过在创建时完全控制并传递所需的帧大小来实现视图高度的变化,例如:

It seems obvious that Apple doesn't particularly invite mucking with the default height of the UIPickerView, but I have found that you can achieve a change in the height of the view by taking complete control and passing a desired frame size at creation time, e.g:

smallerPicker = [[UIPickerView alloc] initWithFrame:CGRectMake(0.0, 0.0, 320.0, 120.0)];

您会发现在各种高度和宽度下,都会出现视觉故障.显然,这些小故障要么需要以某种方式解决,要么选择不会出现它们的其他尺寸.

You will discover that at various heights and widths, there are visual glitches. Obviously, these glitches would either need to be worked around somehow, or choose another size that doesn't exhibit them.

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

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