1

In my application I have to remove this two kind of buttons or give them another function. There were 3 days reading the net and I can't even find how they are called. So to the question: How can I programmaticaly remove them, access them, change their action when tapped? So any help will be appreciated.

Buttons marked in red

Hristo Atanasov
  • 1,236
  • 2
  • 18
  • 25

1 Answers1

0

You can only enable/disable these buttons using allowsActions property but cannot change the actions associated with them.

Determines whether to display buttons for actions such as sending a text message or initiating a FaceTime call.

var allowsActions: Bool

By default the value of this property is true.

Refer to the Apple’s Documentation

Vakas
  • 6,291
  • 3
  • 35
  • 47
  • Based on Your suggestion I wrote an extension to totally disable this buttons but maybe something is wrong. This code doesn't work for hiding this buttons ... Is there something wrong in the code/idea: extension ABPersonViewController { override public func viewWillAppear(animated: Bool) { self.allowsActions = false; } } – Hristo Atanasov Oct 07 '15 at 12:38
  • You're not calling super.viewWillAppear – Vakas Oct 07 '15 at 13:35
  • I've tried that on instance of ABPersonViewController and it's working. I'll check with the extension as well and will get back to you. – Vakas Oct 08 '15 at 04:19
  • The method “viewWillAppear" that you are trying to override is defined in ABPersonViewController, and not to one of its superclasses. And you can't override a method which is defined in the same class. You have to use swizzling to implement that which is a bit complex. I would suggest doing it with the instance of ABPersonViewController. – Vakas Oct 08 '15 at 04:50