【问题标题】:How can I crop my UIPickerView?如何裁剪我的 UIPickerView?
【发布时间】:2012-06-29 04:29:17
【问题描述】:

这是我的水平 UIPickerView(通过旋转和缩放 ori UIpicker):htp://s7.postimage.org/qzez9d0pn/Original.png

现在,我要做的就是切断这两个空格:http://s7.postimage.org/bryzp08uz/Process.png

要获得更好的外观效果:http://s7.postimage.org/6ulf3w6vv/Result.png

有人请帮我怎么做...?

我的旋转和缩放代码:

thePickerView.delegate = self;
thePickerView.showsSelectionIndicator =YES;
thePickerView.center = CGPointMake(xVar, yVar); // position
CGAffineTransform rotate = CGAffineTransformMakeRotation(-3.14/2); // rotate
rotate = CGAffineTransformScale(rotate, 0.1, 1); // scale
[thePickerView setTransform:rotate];

UILabel *theview[num]; 
CGAffineTransform rotateItem = CGAffineTransformMakeRotation(3.14/2);

for (int i=0;i<num;i++) {  
    theview[i] = [[UILabel alloc] init];
    theview[i].text = [NSString stringWithFormat:@"%d",i+1];
    theview[i].textColor = [UIColor blackColor];
    theview[i].frame = CGRectMake(0,0, 100, 100);
    theview[i].backgroundColor = [UIColor clearColor];
    theview[i].textAlignment = UITextAlignmentCenter;
    theview[i].shadowColor = [UIColor whiteColor];
    theview[i].shadowOffset = CGSizeMake(-1,-1);
    theview[i].adjustsFontSizeToFitWidth = YES;

    theview[i].transform = CGAffineTransformScale(rotateItem, 1, 10);
}
itemArray = [[NSMutableArray alloc] init];
for (int j=0;j<num;j++) {[itemArray addObject:theview[j]];}
[thePickerView selectRow:row inComponent:0 animated:NO];
[self.view addSubview:thePickerView];

【问题讨论】:

    标签: xcode uipickerview crop


    【解决方案1】:

    我在搜索和等待更好的编码答案时的临时解决方案是创建一个覆盖背景图像,然后透明 PickerView 的期望空间 =.=

    【讨论】:

      猜你喜欢
      • 2014-01-30
      • 1970-01-01
      • 2011-02-07
      • 2011-07-25
      • 1970-01-01
      • 1970-01-01
      • 2022-11-23
      • 2022-01-25
      相关资源
      最近更新 更多