如何设置按钮以关闭键盘 键位于键盘上方? 自定义键盘
var button: UIButton = UIButton()
required init(globalColors: GlobalColors.Type?, darkMode: Bool, solidColorMode: Bool) {
super.init(globalColors: globalColors, darkMode: darkMode, solidColorMode: solidColorMode)
self.addSubview(self.button)
button.setTitle("Hide", forState: UIControlState.Normal)
self.button.addTarget(self, action: Selector("tappedbutton"), forControlEvents: UIControlEvents.TouchUpInside)
button.setTitleColor(UIColor(red: 24.0/100, green: 116.0/255, blue: 205.0/205, alpha: 1.0), forState: UIControlState.Normal)
self.updateAppearance()
}
override func layoutSubviews() {
super.layoutSubviews()
self.button.frame.origin = CGPointMake(self.button.frame.origin.x + self.button.frame.width + 1, self.button.frame.origin.y)
}