IOS疯狂基础之键盘挡住输入框
2013-05-01 15:52
381 查看
一般来讲就是把整个屏幕上移么,不让键盘遮住
#pragma mark textField delegate
输入完后代理事件
- (void)textFieldDidEndEditing:(UITextField *)textField{
if (textField==remarkText) {
[self
textFieldShouldReturn:textField];
return;
}
#pragma mark-键盘输入
屏幕上移
- (BOOL)textFieldShouldReturn:(UITextField *)textField
{
if (textField==remarkText) {
NSTimeInterval animationDuration =
0.30f;
[UIViewbeginAnimations:@"ResizeForKeyboard"context:nil];
[UIViewsetAnimationDuration:animationDuration];
CGRect rect =
CGRectMake(0.0f,0.0f,
self.view.frame.size.width,self.view.frame.size.height);
self.view.frame = rect;
[UIViewcommitAnimations];
[textField
resignFirstResponder];
}
return
YES;
}
- (void)textFieldDidBeginEditing:(UITextField *)textField
{
if (textField==remarkText) {
NSTimeInterval animationDuration = 0.30f;
[UIViewbeginAnimations:@"ResizeForKeyBoard"context:nil];
[UIViewsetAnimationDuration:animationDuration];
float width = self.view.frame.size.width;
float height = self.view.frame.size.height;
CGRect rect = CGRectMake(0.0f, -300.0,width,height);//整个屏幕上移300
self.view.frame = rect;
[UIViewcommitAnimations];
}
}
#pragma mark textField delegate
输入完后代理事件
- (void)textFieldDidEndEditing:(UITextField *)textField{
if (textField==remarkText) {
[self
textFieldShouldReturn:textField];
return;
}
#pragma mark-键盘输入
屏幕上移
- (BOOL)textFieldShouldReturn:(UITextField *)textField
{
if (textField==remarkText) {
NSTimeInterval animationDuration =
0.30f;
[UIViewbeginAnimations:@"ResizeForKeyboard"context:nil];
[UIViewsetAnimationDuration:animationDuration];
CGRect rect =
CGRectMake(0.0f,0.0f,
self.view.frame.size.width,self.view.frame.size.height);
self.view.frame = rect;
[UIViewcommitAnimations];
[textField
resignFirstResponder];
}
return
YES;
}
- (void)textFieldDidBeginEditing:(UITextField *)textField
{
if (textField==remarkText) {
NSTimeInterval animationDuration = 0.30f;
[UIViewbeginAnimations:@"ResizeForKeyBoard"context:nil];
[UIViewsetAnimationDuration:animationDuration];
float width = self.view.frame.size.width;
float height = self.view.frame.size.height;
CGRect rect = CGRectMake(0.0f, -300.0,width,height);//整个屏幕上移300
self.view.frame = rect;
[UIViewcommitAnimations];
}
}
相关文章推荐
- ios中怎么处理键盘挡住输入框
- iOS——IQKeyBoardManager弹出键盘不会挡住输入框
- iOS 键盘挡住输入框的解决办法
- (转)ios输入框被键盘挡住的解决办法
- ios输入框被键盘挡住的解决办法
- 完善-- iOS之键盘挡住输入框的解决方法
- iOS键盘问题之挡住输入框
- IOS 键盘挡住输入框的问题解决办法
- ios输入框被键盘挡住的解决办法
- ios输入框被键盘挡住的解决办法
- ionic在开发ios系统微信时键盘挡住输入框的解决方法(键盘弹出问题)
- iOS 解决键盘挡住输入框的问题
- iOS 解决键盘挡住输入框的问题
- IOS 解决键盘挡住输入框的问题
- IOS 解决键盘挡住输入框的问题
- ios输入框被键盘挡住的解决办法
- ios输入框被键盘挡住的解决办法
- iOS 输入框被键盘挡住的解决办法
- iOS 解决键盘挡住输入框的问题
- ios输入框被键盘挡住的解决办法