2

Possible Duplicate:
How to change UIPickerView height

I am writing an application. In that application the pickerview height is much smaller than normal size. How do I to decrease the uipickerview height?

Community
  • 1
  • 1
Venkat1282
  • 49
  • 1
  • 5

2 Answers2

6

Interface Builder doesn't let you change the height of a UIPickerView (only the width). The default size of the view is 320x216 but you can change the height manually by opening the parent view's xib (just a big XML file that defines the interface) file and looking for the line:

<object class="IBUIPickerView" id="...  

Then within that XML node you'll see the line (where 93 is the vertical y position):

<string key="NSFrame">{{0, 93}, {320, 216}}</string>  

Just change that 216 to something smaller (in my case, I needed it to be about 150) and recompile! Now - re-open Interface builder and you'll see the change reflected in your interface!

I've found that Apple makes things extremely difficult to do if they don't really want you doing it, however, it's usually possible.

Nitish
  • 13,845
  • 28
  • 135
  • 263
1

You can adjust the height when initializing the picker

urPicker = [[UIPickerView alloc] initWithFrame:CGRectMake(0.0, 0.0, 320.0, urRequiredHeight);
visakh7
  • 26,380
  • 8
  • 55
  • 69