views:

192

answers:

1

I have my pickerview set up and everything works fine, but right now I have that big pickerview taking up a lot of space in Interface Builder. It's annoying having to move it around when working in Interface Builder. How do I set the pickerview and it's location without using IB?

A: 

Try this:

// Add the picker
        UIDatePicker *pickerView = [[UIDatePicker alloc] initWithFrame:CGRectMake(0,100,0,0)];
        [pickerView setDatePickerMode:UIDatePickerModeTime];

        [self.view addSubview:pickerView];
        [self.view showInView:self.view];
        [self.view setBounds:CGRectMake(0,0,320, 500)];

        [pickerView release];

The above code is for UIDatePicker, you may similarly implement it for other types of uipickers as well.

Vibhor Goyal