I have a form that I put inside a scrollview. On this form I have a couple of buttons that puts up a dateTime picker or a pickerView when I press on them. But I was wondering if I can but my form up to show the text that at the moment is behind the pickerView.
I know you can do that with a UITextfield. You can find the explanation over here .
Hope that anyone can help me!
Kind regards!
-(IBAction)btnDate_Clicked:(id)sender
{
[UIView beginAnimations:nil context:NULL];
[UIView setAnimationDuration:0.3];
yourScrollView.frame = CGRectMake(0, -100, 320, yourScrollView.frame.size.height); // set frame which you want
[UIView commitAnimations];
}
and when you want to set original position of scroll then again set the scrollview frame with my animation code for ex.
-(IBAction)btnDone_Clicked:(id)sender
{
[UIView beginAnimations:nil context:NULL];
[UIView setAnimationDuration:0.3];
yourScrollView.frame = CGRectMake(0, 0, 320, yourScrollView.frame.size.height); // set frame which you want
[UIView commitAnimations];
}
使用UIScrollView
的scrollRectToVisible:animated:
方法
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.