1

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?

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,,,

Chatar Veer Suthar
  • 15,541
  • 26
  • 90
  • 154

3 Answers3

3
   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.

pradeepa
  • 4,104
  • 5
  • 31
  • 41
1

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.

Ishu
  • 12,797
  • 5
  • 35
  • 51
0

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.

jAmi
  • 779
  • 7
  • 18