How do you keep the cancel button in the search bar enabled when the keyboard is dismissed?

前端 未结 11 1775
萌比男神i
萌比男神i 2020-12-30 01:23

\"enter \"enter

11条回答
  •  难免孤独
    2020-12-30 02:26

    Here's a recursive solution that is working for me.

    func enableButtons(_ view:UIView) { for subView in view.subviews { enableButtons(subView) } if let buttonView = view as? UIButton { buttonView.isEnabled = true } }

提交回复
热议问题