API improvement: UIControl.AddTarget
- Dominant language
- C#
- Stars
- 2.9k
- Forks
- 576
- Avg merge
- 2d 12h
- Merged PRs (30d)
- 123
Description
The binding that we provide today to `UIControl.AddTarget` is hardcoded to one of the potential method signatures. AddTarget nowadays (or maybe always) supported a vaster set of callbacks, and the actual method invoked today depends on the signature of the selector:
https://developer.apple.com/documentation/uikit/uicontrol#1943645
These are:
```
@IBAction func doSomething()
@IBAction func doSomething(sender: UIButton)
@IBAction func doSomething(sender: UIButton, forEvent event: UIEvent)
```
Today, we only support the first kind, we would need to extend our API to take delegates that take a `` and a `` to handle those scenarios.
Today, a workaround I used was this:
```
slider.AddTarget (this, new ObjCRuntime.Selector ("slider:event:"), UIControlEvent.ValueChanged);
...
[Export ("slider:event:")]
void SliderMovedEvent (UISlider senderSlider, UIEvent uievent)
```
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.