How to display UIView over keyboard in iOS

前端 未结 7 955
醉话见心
醉话见心 2020-12-05 20:04

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? O

7条回答
  •  没有蜡笔的小新
    2020-12-05 20:30

    Swift 4.0

    let customView = UIView(frame: CGRect(x: 0, y: self.view.frame.size.height-300, width: self.view.frame.size.width, height: 300))
    customView.backgroundColor = UIColor.red
    customView.layer.zPosition = CGFloat(MAXFLOAT)
    let windowCount = UIApplication.shared.windows.count
    UIApplication.shared.windows[windowCount-1].addSubview(customView)
    

提交回复
热议问题