【发布时间】:2012-10-10 02:06:01
【问题描述】:
我的视图上有一个 scrollview,因为我拥有所有子视图,如下所示
界面视图
Scroll View
1.ImageView
2.Table view
3.Text View
√√ 要在键盘出现/关闭时移动滚动视图,我在 textview 委托方法中实现了如下逻辑 √√
- (void)textViewDidBeginEditing:(UITextView *)textView;
{
//To move the view down
[UIView beginAnimations:nil context:NULL];
[UIView setAnimationDelegate:self];
[UIView setAnimationDuration:0.3];
[UIView setAnimationBeginsFromCurrentState:YES];
scrollView.frame = CGRectMake(scrollView.frame.origin.x, (scrollView.frame.origin.y - 120), scrollView.frame.size.width, scrollView.frame.size.height);
[UIView commitAnimations];
}
- (void)textViewDidEndEditing:(UITextView *)textView
{
//To move the view down
[UIView beginAnimations:nil context:NULL];
[UIView setAnimationDelegate:self];
[UIView setAnimationDuration:0.3];
[UIView setAnimationBeginsFromCurrentState:YES];
scrollView.frame = CGRectMake(scrollView.frame.origin.x, (scrollView.frame.origin.y + 120), scrollView.frame.size.width, scrollView.frame.size.height);
[UIView commitAnimations];
}
√√ 此方法有助于根据键盘上下移动视图,
但是这里是滚动的问题。
用户不能在键盘上滚动所有视图。视图向上滚动到某个位置如下,我们看不到图片/表格的第一列。
如果用户想在有键盘的情况下显示第一列/个人资料图片是不可能的。如何解决这个问题。
【问题讨论】:
标签: iphone objective-c uiscrollview uitextfield uitextview