【发布时间】:2009-12-19 08:35:48
【问题描述】:
我正在尝试水平滚动选择器视图,这是我的代码。
在 viewDidLoad 中我是这样做的,
CGRect frame = horizontalPickerView.frame;
frame.size.width = 50;
frame.size.height = 216;
frame.origin.x=90;
frame.origin.y = 200;
horizontalPickerView.frame = frame;
horizontalPickerView.transform = CGAffineTransformMakeRotation(3.14159/2);
- (UIView *)pickerView:(UIPickerView *)pickerView viewForRow:(NSInteger)row forComponent:(NSInteger)component reusingView:(UIView *)view{
UILabel *lbl = [[[UILabel alloc] initWithFrame:CGRectMake(0, 0, 30, 20)] autorelease];
lbl.transform = CGAffineTransformMakeRotation(-3.14159/2);
lbl.text = @"hi";
return lbl;
}
但问题是我无法将选择器视图的宽度更改为超过 216.0,如果我尝试这样做,则会留下黑色背景。
CorrectImage http://img709.imageshack.us/img709/6982/picture5g.png这是正确的图片
现在如果我这样做
CGRect frame = horizontalPickerView.frame;
frame.size.width = 50;
frame.size.height = 300;
frame.origin.x=120;
frame.origin.y = 200;
horizontalPickerView.frame = frame;
horizontalPickerView.transform = CGAffineTransformMakeRotation(3.14159/2);
我知道了image http://img46.imageshack.us/img46/2792/picture6b.png
我见过像 Seelibrity 这样的应用程序,其中的选择器具有适合屏幕的宽度。 请帮我解决这个问题?
【问题讨论】:
标签: iphone cocoa-touch xcode iphone-sdk-3.0