Hello I am trying to resize the UIPickerView as below dimension are given, but it is not working at all as I want it to be visible. Here datePicker is UIPickerView which is declared properly and synthesized too, now what should I do?
开发者_JAVA百科datePicker = [[UIPickerView alloc] initWithFrame:CGRectMake(100, 200, 100, 150)];
datePicker.delegate = self;
datePicker.showsSelectionIndicator = YES;
[self.view addSubview:datePicker];
If you are not getting what exactly I mean, you can ask me again,,,
CGAffineTransform s0 = CGAffineTransformMakeScale(scaleFactor, scaleFactor); CGAffineTransform t1 = CGAffineTransformMakeTranslation(x,y); myPickerView.transform = CGAffineTransformConcat(s0, t1);
You can use 0.5 as scalefactor to resize the pickerview to 50%, and change x and y to appropriate values to make pickerview to appear in desired position. Note: import QuartzCore framework.
use this,
CGRect pickerFrame=self.datePicker.frame;
//for change height and width
pickerFrame.size.width=20;
pickerFrame.size.height=40;
//for change in x and y coordinate
pickerFrame.origin.y -=20;
pickerFrame.origin.x -=20;
self.datePicker.frame=pickerFrame;
use this code according to you.
you can adjust the width of a picker but not height. For height, you can overlay images(or anything) over your picker so that it looks small. Hope it helps.
精彩评论