如何在iOS中通过键盘显示UIView

当用户点击inputAccessoryView中的“附加”按钮时,我想在键盘上创建一个简单的视图.
像这样的东西:

有一个简单的方法吗?或者我应该创建我的自定义键盘?

解决方法

您可以将新的子视图添加到应用程序窗口.
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 16 更新版本时,我们听到了困扰 Apple...
欧版/美版 特别说一下,美版选错了 可能会永久丧失4G,不过只...
一般在接外包的时候, 通常第三方需要安装你的app进行测...
前言为了让更多的人永远记住12月13日,各大厂都在这一天将应...