Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/iphone/38.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Iphone 旋转的UIPicker显示标签低分辨率?_Iphone_Xcode_Ios4_Ios_Uipickerview - Fatal编程技术网

Iphone 旋转的UIPicker显示标签低分辨率?

Iphone 旋转的UIPicker显示标签低分辨率?,iphone,xcode,ios4,ios,uipickerview,Iphone,Xcode,Ios4,Ios,Uipickerview,我一直在研究一个水平的UIPicker,我终于让picker和picker上的标签都显示旋转。但是,我现在注意到的问题是,标签以低分辨率显示,具有非常明显的像素化。使用字体值似乎对像素化没有影响。我已经包括了我的代码: //鉴于你没有加载 [super viewDidLoad]; myPicker.delegate = self; myPicker.dataSource = self; myPicker.showsSelectionIndicator =YES;

我一直在研究一个水平的UIPicker,我终于让picker和picker上的标签都显示旋转。但是,我现在注意到的问题是,标签以低分辨率显示,具有非常明显的像素化。使用字体值似乎对像素化没有影响。我已经包括了我的代码:

//鉴于你没有加载

    [super viewDidLoad];
    myPicker.delegate = self;
    myPicker.dataSource = self;
    myPicker.showsSelectionIndicator =YES;
    myPicker.backgroundColor = [UIColor blackColor];

    CGAffineTransform rotate = CGAffineTransformMakeRotation(3.14/2);

    //original settings
    //rotate = CGAffineTransformScale(rotate, 0.1, 0.8);

    rotate = CGAffineTransformScale(rotate, 0.2, 1.65);
    [self.myPicker setTransform:rotate];    

    NSMutableArray *array = [[NSMutableArray alloc] initWithObjects:@"155", @"165", @"175", 
                      @"185", @"195", @"205", @"215", nil];
    self.pickerData = array; 
    [array release];

    NSInteger TOTALITEM = [pickerData count];

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

     UIFont *myFont = [UIFont fontWithName:@"Helvetica" size:10];
     [theview[i] setFont:myFont];
    }


    CGAffineTransform rotateItem = CGAffineTransformMakeRotation(-3.14/2);
    rotateItem = CGAffineTransformScale(rotateItem, 1, 10);

    for (int j=1;j<=TOTALITEM-1;j++) { 
        theview[j].transform = rotateItem;

    }

 pickerData = [[NSMutableArray alloc] init];


 for (int j=1;j<=TOTALITEM-1;j++) { 

     [pickerData addObject:theview[j]];

  }
[super viewDidLoad];
myPicker.delegate=self;
myPicker.dataSource=self;
myPicker.showsSelectIndicator=是;
myPicker.backgroundColor=[UIColor blackColor];
CGAffineTransform rotate=CGAffineTransformMakeRotation(3.14/2);
//原始设置
//旋转=CGAffineTransformScale(旋转,0.1,0.8);
旋转=CGAffineTransformScale(旋转,0.2,1.65);
[self.myPicker setTransform:rotate];
NSMUTABLEARRY*array=[[NSMUTABLEARRY alloc]initWithObjects:@“155”、“165”、“175”,
@"185,"195,"205,"215,无";;
self.pickerData=数组;
[阵列释放];
NSInteger TOTALITEM=[pickerData count];
UILabel*视图[TOTALITEM-1];//+一比零

对于(int i=1;i我发现了这个问题,所以我想我会在这里发布答案。现在很明显。我在文本上使用了与UIPicker相同的缩放变换设置。为了解决这个问题,我将文本上的变换减少了50%,并使用字体大小来控制标签的大小。下面是我更改的代码:

原件:

 UIFont *myFont = [UIFont fontWithName:@"Helvetica" size:10];
 [theview[i] setFont:myFont];
}


CGAffineTransform rotateItem = CGAffineTransformMakeRotation(-3.14/2);
rotateItem = CGAffineTransformScale(rotateItem, 1, 10);
固定的:

 UIFont *myFont = [UIFont fontWithName:@"Helvetica" size:30];
 [theview[i] setFont:myFont];
}


CGAffineTransform rotateItem = CGAffineTransformMakeRotation(-3.14/2);
rotateItem = CGAffineTransformScale(rotateItem, .5, 5);