UIPickerView高度不可更改 [英] UIPickerView Height not changeable

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

问题描述

我正在尝试更改PickerView的高度

I'm trying to change PickerView's height

self.pickerView = [[UIPickerView alloc] init];
self.pickerView.frame = CGRectMake(0, 0, frame.size.width, frame.size.height);

Xcode日志显示以下消息:

Xcode log shows the following message:

-[UIPickerView setFrame:]: invalid height value 274.0 pinned to 216.0 

如何更改其高度?

推荐答案

这里只有 有效 高度 UIPickerView (162.0,180.0和216.0)

您可以使用 CGAffineTransformMakeTranslation CGAffineTransformMakeScale 函数妥善安装拣货员以方便您的使用。

You can use the CGAffineTransformMakeTranslation and CGAffineTransformMakeScale functions to properly fit the picker to your convenience.

示例:

CGAffineTransform t0 = CGAffineTransformMakeTranslation (0, pickerview.bounds.size.height/2);
CGAffineTransform s0 = CGAffineTransformMakeScale       (1.0, 0.5);
CGAffineTransform t1 = CGAffineTransformMakeTranslation (0, -pickerview.bounds.size.height/2);
pickerview.transform = CGAffineTransformConcat          (t0, CGAffineTransformConcat(s0, t1));

以上代码更改 高度 选择器 查看到一半 re -position 它到确切的(Left-x1,Top-y1)位置。

The above code change the height of picker view to half and re-position it to the exact (Left-x1, Top-y1) position.

请参阅此处

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

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