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

查看:167
本文介绍了如何更改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.

推荐答案

p>很明显,苹果并不特别邀请使用 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天全站免登陆