对于此线程上公认的解决方案: 如何在 iPhone 上缩小 UIPickerView?
我可以成功地重新调整选择器的大小。但是我的控制器中有两个选择器。当我对两个选择器进行练习时,它们会重新调整大小,但是当将转换后的 UIView 添加到主视图时,转换后的子视图之一会丢失触摸输入。丢失触摸输入的总是首先添加的子视图。我怎样才能解决这个问题?
这是代码:
CGSize providerPickerSize = [providerPickerOutlet sizeThatFits:CGSizeZero];
CGSize amountPickerSize = [amountPickerOutlet sizeThatFits:CGSizeZero];
UIView *providerPickerTransformView = [[UIView alloc] initWithFrame:CGRectMake(0.0f, 0.0f, providerPickerSize.width, providerPickerSize.height)];
UIView *amountPickerTransformView = [[UIView alloc] initWithFrame:CGRectMake(0.0f, 0.0f, amountPickerSize.width, amountPickerSize.height)];
providerPickerTransformView.transform = CGAffineTransformMakeScale(0.75f, 0.75f);
amountPickerTransformView.transform = CGAffineTransformMakeScale(0.75f, 0.75f);
[providerPickerTransformView addSubview:providerPickerOutlet];
[amountPickerTransformView addSubview:amountPickerOutlet];
[self.view addSubview:amountPickerTransformView];
[self.view addSubview:providerPickerTransformView];
这里的 amountPickerTransformView 失去了触摸输入。
使用带有故事板的 XCode 4.3、iOS 5。