TabBar as inputView for UITextView iOS || when click on textView tabbar should be open iOS swift
Solution:
It was easy that if you change the inputaccessory view as tab bar for your uitextViewdelegate it will be works good like pickerView input.
The below code is used for when the user click on the textView the tabbar will be open.You can perform more actions on the tabbar.
}
It was easy that if you change the inputaccessory view as tab bar for your uitextViewdelegate it will be works good like pickerView input.
The below code is used for when the user click on the textView the tabbar will be open.You can perform more actions on the tabbar.
class ViewController:UIViewController {
override func viewDidLoad() {
addToolBar(textView: TxtView)
}}
extension ViewController: UITextViewDelegate {
func addToolBar(textView: UITextView) {
let toolBar = UIToolbar()
toolBar.barStyle = .default
toolBar.isTranslucent = false
toolBar.barTintColor = UIColor.white
toolBar.tintColor = UIColor(red: 76 / 255, green: 217 / 255, blue: 100 / 255, alpha: 1)
let Btn: UIButton = UIButton(type: UIButtonType.custom)
Btn.frame = CGRect(x: 0, y: 0, width: 75, height: 51)
Btn.backgroundColor = UIColor.white
Btn.layer.borderWidth = 1.0
Btn.layer.cornerRadius = 4
toolBar.setItems([Btn], animated: false)
toolBar.isUserInteractionEnabled = true
toolBar.sizeToFit()
textView.delegate = self
textView.inputAccessoryView = toolBar
}
Comments
Post a Comment