就是一个AView里面包含两个textField, 如果随便点击其中一个, AView就会往上跑了,当然AView里面的内容也跟着移动, 没有设置到setContentOffset之类的
解决方案 »
- 命令./configure的问题
- 急:iphone 一个关于按钮的问题
- 求教:不经用户确认触发,获取GPS信息
- 新人求助:分段发数据问题
- WebKit discarded an uncaught exception in the webView
- ios7以后如何强制某个controller横屏
- 这是什么错误?
- CoreText的CTLineGetGlyphRuns返回个数问题
- 别看人家效率高,其实是他学会了“偷懒“。刚开发了个小工具分享一下!!
- 关于Objective-C中Method Swizzling完美方案的一些疑问
- storyboard TableView reloadData 不刷新,盼指点
- 请问学习了OC之后,想做个打小蜜蜂的游戏练手,该怎么做?
setFrame没用的, 我测试过 点和不点 uitextfield 后的 frame,都是一样的
//恢复原始视图位置
-(void)resumeView
{
if ( _mbIsShowKeyboard )
{
NSTimeInterval animationDuration=0.30f;
[UIView beginAnimations:@"ResizeForKeyboard" context:nil];
[UIView setAnimationDuration:animationDuration];
//如果当前View是父视图,则Y为20个像素高度,如果当前View为其他View的子视图,则动态调节Y的高度
float fX = self.view.frame.origin.x;
float fY = self.view.frame.origin.y + 130;
float width = self.view.frame.size.width;
float height = self.view.frame.size.height;
//上移30个单位,按实际情况设置
self.view.frame = CGRectMake(fX, fY, width, height);
[UIView commitAnimations];
_mbIsShowKeyboard = false;
}
}// 移动窗口
-(void) moveView
{
if ( !_mbIsShowKeyboard )
{
NSTimeInterval animationDuration=0.30f;
[UIView beginAnimations:@"ResizeForKeyboard" context:nil];
[UIView setAnimationDuration:animationDuration];
float fX = self.view.frame.origin.x;
float fY = self.view.frame.origin.y - 130;
float width = self.view.frame.size.width;
float height = self.view.frame.size.height;
//上移30个单位,按实际情况设置
self.view.frame = CGRectMake(fX, fY, width, height);
[UIView commitAnimations];
_mbIsShowKeyboard = true;
}
}自己多尝试下,如果想要完整的工程,百度一下,一大把。