This commit is contained in:
yuanke 2016-09-01 13:36:27 +08:00
parent 251fd36748
commit a6241afe04
1 changed files with 5 additions and 38 deletions

View File

@ -12,48 +12,15 @@ app.directive('iphoneRecognize',["$timeout",function(timer){
element.css({"position":"relative","padding":"1px 0"});
$(".post-wrapper").css("marginBottom","0");
$("#all_homework_reply").css("marginBottom","0");
// window.scrollTo(0,contentHeight);
}
window.scrollTo(0,contentHeight);
};
if (/ipad|iphone|mac/i.test(navigator.userAgent)){
//开始编辑输入框的时候,软键盘出现,执行此事件
-(void)textFieldDidBeginEditing:(UITextField *)textlab
{
//获取当前输入框的位置信息
CGRect frame = textlab.frame;
//获取键盘底部位置与键盘最高点之间的距离键盘高度256
int offset = frame.origin.y + frame.size.height - (self.view.frame.size.height - 256.0);
//设置视图上升的时间
NSTimeInterval animaTime = 0.30f;
//字符串随意也行...
[UIView beginAnimations:@"ResizeForKeyboard" context:nil];
//添加视图上的上升时间0.3f
[UIView setAnimationDuration:animaTime];
//将视图的Y坐标向上移动offset个单位以使下面腾出地方用于软键盘的显示
if(offset > 0)
self.view.frame = CGRectMake(0.0f, -offset, self.view.frame.size.width, self.view.frame.size.height);
//提交动画
[UIView commitAnimations];
}
//当用户按下return键或者按回车键keyboard消失
-(BOOL)textFieldShouldReturn:(UITextField *)textField
{
//收回键盘第一响应者意思...
[textField resignFirstResponder];
return YES;
}
//输入框编辑完成以后,将视图恢复到原始状态
-(void)textFieldDidEndEditing:(UITextField *)textField
{
self.view.frame =CGRectMake(0, 0, self.view.frame.size.width, self.view.frame.size.height);
}
$("#postInput1").bind('focus',function(){
toBottom();
});
// $("#postInput1,#replyBlock").bind("click",function(){
// toBottom();
// });
$("#postInput1,#replyBlock").bind("click",function(){
toBottom();
});
$("#postInput1").bind('blur',function(){
element.css("position","fixed");
$(".post-wrapper").css("marginBottom","10px");