获取
回答
设置一个UITextViewDelegate
并实现textViewDidBeginEditing:
委托方法。当它被调用时,访问文本视图的inputAccessoryView
属性。然后看看视图的frame
属性。
该框架可能位于窗口坐标中。根据您的需要,您可能需要将窗口坐标的框架转换为另一个视图的坐标。详情请参阅UIView convertRect:...
方法。
谢谢!我不敢相信我没有想到! –
这里是苹果公司的有关管理文件键盘:http://developer.apple.com/library/ios/#documentation/StringsTextFonts/Conceptual/TextAndWebiPhoneOS/KeyboardManagement/KeyboardManagement.html
观察UIKeyboardDidShowNotification通知和查询用户信息字典的UIKeyboardFrameEndUserInfoKey获取包含键盘的CGRect的NSValue。
更多UIKeyboardDidShowNotification这里:http://developer.apple.com/library/ios/#documentation/UIKit/Reference/UIWindow_Class/UIWindowClassReference/UIWindowClassReference.html#//apple_ref/c/data/UIKeyboardDidShowNotification
嗨阿卜杜拉,你的问题[已被问及之前回答](http://stackoverflow.com/questions/10955888/ios-keyboard-location-and-orientation)。您可以通过注册“UIKeyboard *”通知来获取键盘位置。 –
我试过解决方案,但我没有得到输入附件视图y的位置。 –