Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to make a UIPickerView slide half way up the screen?

Tags:

ios

iphone

enter image description here

when someone clicks clothing, I want the UIPickerView to slide up as in the example as follows: enter image description here

Can someone show a code sample please?

like image 579
jini Avatar asked May 27 '11 04:05

jini


2 Answers

as dsc and Jason said, if you are using tableview, use its delegate method didSelectRowAtIndexPath , in it call an pickerview in an actionsheet.

To know how to call an pickerview in an actionsheet, check this link: Add UIPickerView & a Button in Action sheet - How?

like image 123
SriPriya Avatar answered Oct 18 '22 15:10

SriPriya


Update:
This version is deprecated: use ActionSheetPicker instead.

You can use animation if you want a "sliding" effect

[pickerView setFrame: CGRectMake([[self view] frame].origin.x, [[self view] frame].origin.y + 480.0, [[self view] frame].size.width, [[self view] frame].size.height)];
[UIView beginAnimations: nil context: NULL];
[UIView setAnimationDuration: 0.25];
[UIView setAnimationCurve: UIViewAnimationCurveEaseInOut];
[pickerView setFrame: yourDesiredEndFrame];
[UIView commitAnimations];

It's not tested but will give you an idea

like image 7
Angelo Avatar answered Oct 18 '22 16:10

Angelo