uibutton

Is weak self needed for table view cell button closure

吃可爱长大的小学妹 提交于 2021-01-28 11:34:51
问题 In trying to avoid retain cycles, would using [weak self] in in a UITableViewCell button action be necessary? Example: in ViewController's cellForRow cell.buttonAction = { (cell) [weak self] in self.someFunction() } in TableViewCell class var buttonAction: ((UITableViewCell) -> Void)? @IBAction func buttonPressed(_ sender: Any) { buttonAction?(self) } 回答1: The key line to think about is: var buttonAction: ((UITableViewCell) -> Void)? You are offering to store a function long-term in an

Swift UIButton - How to remove underline?

不想你离开。 提交于 2021-01-27 02:21:31
问题 I have problem when in iOS settings is enabled this setting "Button Shapes" It causing this underline in application (first picture with enabled setting, second without) Any idea how to programatically or in storyboard disable it? I tried attributed text but I get same result :( I'm newbie in Swift. Thanks for help! 回答1: It's not a problem. You should not make any attempt to counter any accessibility changes set by the user. They are there for a reason. 回答2: This is an answer by user4291543

UIButton background color overlaps text on highlight

强颜欢笑 提交于 2020-12-10 08:04:55
问题 After I set my UIButton 's backgroundColor and textColor for state highlighted the following output is presented: The problem here is that the button's background overlaps the white text. How can I solve this? I also have lots of problem on tvOS with setting the background and text color from the Interface Builder (not working from State Config ). I have to make a combination of the IB's properties and code. Here is my code: if shopNowButton.highlighted == true { shopNowButton.highlighted =

UIButton background color overlaps text on highlight

亡梦爱人 提交于 2020-12-10 08:03:14
问题 After I set my UIButton 's backgroundColor and textColor for state highlighted the following output is presented: The problem here is that the button's background overlaps the white text. How can I solve this? I also have lots of problem on tvOS with setting the background and text color from the Interface Builder (not working from State Config ). I have to make a combination of the IB's properties and code. Here is my code: if shopNowButton.highlighted == true { shopNowButton.highlighted =

UIButton background color overlaps text on highlight

半世苍凉 提交于 2020-12-10 08:02:34
问题 After I set my UIButton 's backgroundColor and textColor for state highlighted the following output is presented: The problem here is that the button's background overlaps the white text. How can I solve this? I also have lots of problem on tvOS with setting the background and text color from the Interface Builder (not working from State Config ). I have to make a combination of the IB's properties and code. Here is my code: if shopNowButton.highlighted == true { shopNowButton.highlighted =

Button to instanciate ViewController is not working after hiding it

六眼飞鱼酱① 提交于 2020-12-06 06:51:47
问题 I have this very weird problem that I just found out... I have this button which is triggering this function : @objc func vergessenTapped() { let forgotPasswordVC = self.storyboard?.instantiateViewController(withIdentifier: "ForgotPasswordVC") as! ForgotPasswordVC forgotPasswordVC.email = self.emailTextField.text! self.present(forgotPasswordVC, animated: true, completion: nil) } I also have these function which hide / show the button above: // delegate Methode für eye-Button func

Button to instanciate ViewController is not working after hiding it

微笑、不失礼 提交于 2020-12-06 06:51:45
问题 I have this very weird problem that I just found out... I have this button which is triggering this function : @objc func vergessenTapped() { let forgotPasswordVC = self.storyboard?.instantiateViewController(withIdentifier: "ForgotPasswordVC") as! ForgotPasswordVC forgotPasswordVC.email = self.emailTextField.text! self.present(forgotPasswordVC, animated: true, completion: nil) } I also have these function which hide / show the button above: // delegate Methode für eye-Button func

Button to instanciate ViewController is not working after hiding it

折月煮酒 提交于 2020-12-06 06:51:05
问题 I have this very weird problem that I just found out... I have this button which is triggering this function : @objc func vergessenTapped() { let forgotPasswordVC = self.storyboard?.instantiateViewController(withIdentifier: "ForgotPasswordVC") as! ForgotPasswordVC forgotPasswordVC.email = self.emailTextField.text! self.present(forgotPasswordVC, animated: true, completion: nil) } I also have these function which hide / show the button above: // delegate Methode für eye-Button func