i have a srollview with textfields and labels as its subview, for two textfields i want to show UIpickerview.
For example: when user touches textfield11 i want to show a picker that slides up from the bottom of the screen, at this point i want to change height of my scrollview too, but it is not working.
CGRect scrollframe = scrollView.frame;
NSLog(@"scrollframe.height=%f, pick height=%f",scrollframe.size.height, pick.frame.size.height);
scrollframe.size.height -= pick.frame.size.height;
[UIView beginAnimations:@"start" context:NULL];
[UIView setAnimationDuration:0.2];
[UIView setAnimationBeginsFromCurrentState:YES];
[scrollView setFrame:scrollframe];
NSLog(@"scroll height = %f",scrollframe.size.height);
NSLog(@"scrollview height = %f", scrollView.frame.size.height);
[pick setFrame:CGRectOffset([pick frame], 0, -220)];
[UIView commitAnimations];
This is console log..
2011-06-08 10:43:31.316 AESDirect[281:207] scrollframe.height=416.000000, pick height=216.000000
2011-06-08 10:43:31.316 AESDirect[281:207] scroll height = 200.000000
2011-06-08 10:43:31.317 AESDirect[281:207] scrollview height = 200.000000


This might help you:
You can call the above code via the same function from where you are calling the pickerView. So this way you don’t have to change the height of the scrollview.
Your code should be like this then:
Make all three of them as Global in .h file and then you will have better control on their behavior. Your picker view is moving along with other items of scroll view because you might have add picker view as subview on your scroll view.