如何在iOS中通过键盘显示UIView [英] How to display UIView over keyboard in iOS
本文介绍了如何在iOS中通过键盘显示UIView的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
当用户点击inputAccessoryView中的附加按钮时,我想在键盘上创建一个简单的视图。
这样的事情:
I want to create a simple view over keyboard, when users tap "Attach" button in inputAccessoryView. Something like this:
是有一个简单的方法吗?或者我应该创建自定义键盘?
Is there an easy way to do it? Or i should create my custom keyboard?
推荐答案
您可以将新的子视图添加到应用程序窗口。
You can add that new subview to your application window.
func attach(sender : UIButton)
{
// Calculate and replace the frame according to your keyboard frame
var customView = UIView(frame: CGRect(x: 0, y: self.view.frame.size.height-300, width: self.view.frame.size.width, height: 300))
customView.backgroundColor = UIColor.redColor()
customView.layer.zPosition = CGFloat(MAXFLOAT)
var windowCount = UIApplication.sharedApplication().windows.count
UIApplication.sharedApplication().windows[windowCount-1].addSubview(customView);
}
这篇关于如何在iOS中通过键盘显示UIView的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文