Tag: 键盘事件

什么是我做错了在退出键盘时在iOS中调整我的视图

我有我的viewController 6 Textfields。 第一行是2,第二行是1,第三行是1,最后一行是2。 只要input文本字段就可以正常工作。 出现键盘时,我只是遇到问题而向上和向下滚动视图。 视图滚动正常,但当我“辞职响应者”, 视图向下滚动,但向下滚动太多。 例如,如果视图向上移动了一个数量,那么一旦我退出响应者,视图将向下移动一个大于y的值。 我有下面的代码设置(我已经提供了额外的代码,以防万一,但我相信问题是在setViewMovedUp方法,但我可能是错的): 键盘显示: -(void)keyboardWillShow:(NSNotification*)sender { // Animate the current view out of the way NSDictionary* info = [sender userInfo]; kbSize = [[info objectForKey:UIKeyboardFrameBeginUserInfoKey] CGRectValue].size; if (!didViewMove) { didViewMove = YES; if (self.view.frame.origin.y >= 0) { [self setViewMovedUp:YES]; } else if (self.view.frame.origin.y < 0) { [self setViewMovedUp:NO]; } […]

在iOS中出现键盘之前,在“焦点”开始/ Fire事件之前触发事件

我想在关注textarea(即在iOS上出现键盘之前)之前触发一个事件。 这可能吗? 我的代码来处理焦点在这里: $(document).on('focus', 'textarea', function() { console.log("focus event"); });

iOS为什么已经将ToolBar与键盘间隔开了

我想通过出现的键盘如何移动我的工具栏与button和文本字段: – (void) liftMainViewWhenKeybordAppears:(NSNotification*)aNotification { NSDictionary* userInfo = [aNotification userInfo]; NSTimeInterval animationDuration; UIViewAnimationCurve animationCurve; CGRect keyboardFrame; [[userInfo objectForKey:UIKeyboardAnimationCurveUserInfoKey] getValue:&animationCurve]; [[userInfo objectForKey:UIKeyboardAnimationDurationUserInfoKey] getValue:&animationDuration]; [[userInfo objectForKey:UIKeyboardFrameBeginUserInfoKey] getValue:&keyboardFrame]; [UIView beginAnimations:nil context:nil]; [UIView setAnimationDuration:animationDuration]; [UIView setAnimationCurve:animationCurve]; [self.navigationController.toolbar setFrame:CGRectMake(self.navigationController.toolbar.frame.origin.x, self.navigationController.toolbar.frame.origin.y – keyboardFrame.size.height +self.navigationController.toolbar.frame.size.height, self.navigationController.toolbar.frame.size.width, self.navigationController.toolbar.frame.size.height)]; [UIView commitAnimations]; } 一切工作正常,但移动的工具栏和键盘之间有一个小的差距: 我无法弄清楚这个问题? 可能是什么问题或者是预期的行为? 谢谢!

NSNotificationCenter Swift 3.0在键盘上显示和隐藏

我想在键盘显示和消失时运行一个函数,并具有以下代码: let notificationCenter = NotificationCenter.default notificationCenter.addObserver(self, selector: #selector(ViewController.keyBoardUp(Notification :)), name: NSNotification.Name.UIKeyboardWillShow, object: nil) 而下面的functionkeyBoardUp : func keyBoardUp( Notification: NSNotification){ print("HELLO") } 但是,键盘显示时,该function不会打印到控制台。 帮助将不胜感激

如何在Javascript / Sencha中听键盘打开/closures?

我有一个HTML5 / Javascript(Sencha)应用程序,我已经在XCode中打包到iOS的PhoneGap中。 无论如何,我希望能够听到键盘开/关事件,并做相应的事情。 有没有办法做到这一点?

禁用键盘上的键

我是Objective-C的新手,我正在寻求限制用户从普通键盘的字母部分切换到数字/标点符号。 这就是说,我想禁用键盘上的开关button。 也许我正在input错误的search参数,但是我在Google上发现的很less,在我的参考书中更less。 我将如何去实际禁用iOS键盘上的button? 使用字母/数字/标点字符时,只需忽略input的input字符即可轻松完成此操作,但是在键盘部分之间切换的button会执行操作而不是返回字符。 感谢您的帮助!

点击UITextField时,移动键盘上方的UIButton

我有3个文本字段和2个button。 当我点击文本字段时,键盘出现,并且由于键盘,2个button被隐藏。 是否可以移动键盘上方的button,以及当键盘退出时,button应该返回到其初始位置。

检测国际键盘的出现和消失

当出现键盘时,是否有办法检测到它是一个国际键盘(在普通键盘的顶部带有一个额外的色带以显示国际字符),并获取它的帧大小? 我需要使用该信息向上移动(如果需要)键盘上方的视图。

UITextView在iphone中隐藏键盘

我想在用户按下UITextView对象在iphone中返回时隐藏键盘。 但是,神秘的是,这不适用于UITextView但为UITextField工作。 我无法弄清楚为什么… 这就是我所做的: 1)我在XCode4中创build了一个基于视图的应用程序。 2)在.xib中创build了UITextView , UITextField和UIButton对象 3)将UITextField和UITextView代表标记为Outlets中的文件所有者 4)在.h中的@interface UIViewController中添加了<UITextFieldDelegate> 5)在.m中添加了textFieldShouldReturn函数 这里是代码: .h文件 @interface keyboardDisappearViewController : UIViewController <UITextFieldDelegate> { UITextView *textBoxLarge; UITextField *textBoxLittle; } @property (nonatomic, retain) IBOutlet UITextView *textBoxLarge; @property (nonatomic, retain) IBOutlet UITextField *textBoxLittle; – (IBAction)doSomething:(id)sender; @end .m文件 – (BOOL) textFieldShouldReturn:(UITextField *)theTextField { NSLog(@"textFieldShouldReturn Fired :)"); [textBoxLarge resignFirstResponder]; [textBoxLittle resignFirstResponder]; return YES; […]