iOS键盘弹出的处理
来源:互联网 发布:mac有哪些好用的软件 编辑:程序博客网 时间:2024/05/14 08:34
#pragma mark -view自动调整位置
- (void)changeContentViewPosition:(NSNotification *)notification{
UIWindow *window = [[[UIApplicationsharedApplication]delegate]window];
[window setBackgroundColor:[UIColorwhiteColor]];
NSDictionary *dict = [notification userInfo];
NSValue *value = [dictobjectForKey:UIKeyboardFrameEndUserInfoKey];
CGFloat keyboardHeight = value.CGRectValue.size.height;
NSNumber *duration = [dictobjectForKey:UIKeyboardAnimationDurationUserInfoKey];
NSNumber *curve = [dictobjectForKey:UIKeyboardAnimationCurveUserInfoKey];
if (self.nameText.isFirstResponder) {
}elseif(self.wayText.isFirstResponder){
CGFloat offsetTop = viewHeight - CGRectGetMaxY(self.wayHolder.frame);
if (offsetTop < keyboardHeight) {
offsetTop = offsetTop - keyboardHeight;
[UIViewanimateWithDuration:duration.floatValueanimations:^{
[UIViewsetAnimationBeginsFromCurrentState:YES];
[UIView setAnimationCurve:curve.intValue];
self.view.frame =CGRectMake(0, offsetTop,self.view.frame.size.width,self.view.frame.size.height);
}];
}
}elseif (self.integralText.isFirstResponder){
CGFloat offsetTop = viewHeight - CGRectGetMaxY(self.integralHolder.frame);
if (offsetTop < keyboardHeight) {
offsetTop = offsetTop - keyboardHeight;
[UIViewanimateWithDuration:duration.floatValueanimations:^{
[UIViewsetAnimationBeginsFromCurrentState:YES];
[UIView setAnimationCurve:curve.intValue];
self.view.frame =CGRectMake(0, offsetTop,self.view.frame.size.width,self.view.frame.size.height);
}];
}
}elseif (self.addressText.isFirstResponder){
CGFloat offsetTop = viewHeight - CGRectGetMaxY(self.addressHolder.frame);
if (offsetTop < keyboardHeight) {
offsetTop = offsetTop - keyboardHeight;
[UIViewanimateWithDuration:duration.floatValueanimations:^{
[UIViewsetAnimationBeginsFromCurrentState:YES];
[UIView setAnimationCurve:curve.intValue];
self.view.frame =CGRectMake(0, offsetTop,self.view.frame.size.width,self.view.frame.size.height);
}];
}
}elseif (self.declareTextView.isFirstResponder){
CGFloat offsetTop = -keyboardHeight+64;
[UIViewanimateWithDuration:duration.floatValueanimations:^{
[UIViewsetAnimationBeginsFromCurrentState:YES];
[UIView setAnimationCurve:curve.intValue];
self.view.frame =CGRectMake(0, offsetTop,self.view.frame.size.width,self.view.frame.size.height);
}];
}
}
#pragma mark -keyboardWillHide
- (void)resumeContentViewPosition:(NSNotification *)notification{
NSDictionary *dict = [notification userInfo];
NSNumber *duration = [dictobjectForKey:UIKeyboardAnimationDurationUserInfoKey];
NSNumber *curve = [dictobjectForKey:UIKeyboardAnimationCurveUserInfoKey];
[UIViewanimateWithDuration:duration.doubleValueanimations:^{
[UIView setAnimationCurve:curve.intValue];
self.view.frame =CGRectMake(0,viewOriginY,self.view.frame.size.width,self.view.frame.size.height);
}];
}
- iOS键盘弹出的处理
- 对键盘弹出的处理
- iOS-键盘弹出的类型
- 弹出键盘遮挡按钮的处理方法
- iOS中处理键盘弹出时,scrollview或者tableview的调整
- iOS开发键盘的弹出风格设置
- iOS键盘的弹出与关闭总结
- iOS键盘弹出又消失的问题
- ionic在IOS的键盘弹出问题
- 处理键盘弹出
- 处理键盘弹出事件
- 处理键盘弹出
- iOS键盘的简单处理
- iOS监听键盘弹出,获取键盘的高度
- iOS 键盘弹出时获取键盘的高度
- iOS监听键盘弹出
- iOS 键盘弹出效果
- iOS wkwebview 弹出键盘
- 通过广播监听网络状态
- C# 第一天
- 文章标题
- SLL相关
- Tomcat下,用MyEclipse建立web应用发布两种方法
- iOS键盘弹出的处理
- linux 查看用户上次修改密码的日期
- hdoj Flying to the Mars 1800 (DP)
- springmvc restful Did not find handler method for
- 自定义带 vip 标识的 圆形头像(圆形ImageView)
- Java使用RSA加密解密签名及校验
- PHP设计模式之一策略模式
- Notes on Understanding the Linux Kernel
- 深入解析 Java 8 的日期和时间