Ios InputAccessoryView';s的子视图工具栏按钮不工作
我尝试向Inputaccessoryview添加两个不同的工具栏。但是InputAccessoryView的子视图工具栏按钮不起作用 我尝试创建两个单独的uitoolbar,并将其中一个添加为inputaccessoryview。然后我添加了第二个工具栏作为子视图。它看起来很好,但按钮不起作用,它只是在那里看 这是我的密码Ios InputAccessoryView';s的子视图工具栏按钮不工作,ios,swift,toolbar,inputaccessoryview,Ios,Swift,Toolbar,Inputaccessoryview,我尝试向Inputaccessoryview添加两个不同的工具栏。但是InputAccessoryView的子视图工具栏按钮不起作用 我尝试创建两个单独的uitoolbar,并将其中一个添加为inputaccessoryview。然后我添加了第二个工具栏作为子视图。它看起来很好,但按钮不起作用,它只是在那里看 这是我的密码 let entryToolbar = UIToolbar(frame:CGRect(x: 0, y: -50, width: UIScreen.main.bo
let entryToolbar = UIToolbar(frame:CGRect(x: 0, y: -50, width: UIScreen.main.bounds.width, height: 50))
entryToolbar.barStyle = Theme.barStyle!
entryToolbar.tintColor = Theme.userColor
let sendToolbar = UIToolbar(frame:CGRect(x: 0, y: -0, width: UIScreen.main.bounds.width, height: 50))
sendToolbar.barStyle = Theme.barStyle!
sendToolbar.tintColor = Theme.userColor
sendToolbar.items = [
UIBarButtonItem(title: "gönder", style: .plain, target: self, action: #selector(gonder)),
UIBarButtonItem(barButtonSystemItem: .flexibleSpace, target: self, action: nil),
UIBarButtonItem(title: "vazgeç", style: .plain, target: self, action: #selector(vazgec))]
entryToolbar.items = [
UIBarButtonItem(title: "(bkz:)", style: .plain, target: self, action: #selector(bkz)),
UIBarButtonItem(title: "hede", style: .plain, target: self, action: #selector(hede)),
UIBarButtonItem(barButtonSystemItem: .flexibleSpace, target: self, action: nil),
UIBarButtonItem(title: "*", style: .plain, target: self, action: #selector(gizlihede)),
UIBarButtonItem(barButtonSystemItem: .flexibleSpace, target: self, action: nil),
UIBarButtonItem(title: "-spoiler-", style: .plain, target: self, action: #selector(spoiler)),
UIBarButtonItem(title: "http://", style: .plain, target: self, action: #selector(link))]
sendToolbar.sizeToFit()
sendToolbar.addSubview(entryToolbar)
entryGir.inputAccessoryView = sendToolbar
如何将多工具栏添加为inputaccessoryview,以及如何使用此按钮
这是我的viewcontroller的一个视图。
您不能将任何子视图添加到
UIToolbar
。要使工具栏如图所示,您需要做的是:创建扩展UIView
的自定义类,逐个代码配置该自定义UIView
UI,或从NIB
加载它,并在该自定义类实现中编写按钮和其他UI元素的所有控制逻辑。然后只需将自定义的ui视图
用作inputAccessoryView
。
您可以获得有关从何处开始自定义
inputAccessoryView
实现的更多信息。您不能将任何子视图添加到UIToolbar
。要使工具栏如图所示,您需要做的是:创建扩展UIView
的自定义类,逐个代码配置该自定义UIView
UI,或从NIB
加载它,并在该自定义类实现中编写按钮和其他UI元素的所有控制逻辑。然后只需将自定义的ui视图
用作inputAccessoryView
。
您可以获得有关从何处开始自定义
inputAccessoryView
实现的更多信息。工具栏不能将另一个工具栏作为子视图。一个工具栏根本不能有任何子视图。那么我如何才能将多个工具栏添加为inputaccessoryview?你不能。但是,这里根本不需要使用工具栏。工具栏不能有另一个工具栏作为子视图。一个工具栏根本不能有任何子视图。那么我如何才能将多个工具栏添加为inputaccessoryview?你不能。但是,你在这里根本不需要使用工具栏。我明白了。谢谢,我会的!我懂了。谢谢,我会的!