[MonoTouch] binding my own protocol

Nic Wise nicw at fastchicken.co.nz
Wed Dec 7 06:52:36 EST 2011


Hi there.

I've been reading this:
http://docs.xamarin.com/ios/tutorials/Events%2c_Protocols_and_Delegates

Am I correct in thinking I can make my own abstract class for a
protocol I want to use (UIAccessability in this case):

[Register("UIAccessability", Model]
public abstract class UIAccessability : NSObject
{
  //methods and bindings using [Export] in here
  public virtual string AccessabilityLabel {
    [Export("accessibilityLabel")]get;
    [Export("setAccessibilityLabel:")]set;
  }
}

Then, on a button, I could do:

UIButton button = whatever's needed to set it up

var acc = button as UIAccessability;

if (acc != null)
  acc.AccessabilityLabel = "foo!";

etc

Correct? No need to btouch it, as I'm not bringing in a new library -
it's all in UIKit??




Failing that: http://bugzilla.xamarin.com/show_bug.cgi?id=2360

Thanks

N

-- 
Nic Wise
t.  +44 7788 592 806 | @fastchicken | http://www.linkedin.com/in/nicwise
b. http://www.fastchicken.co.nz/

Nearest Bus: find when the next bus is coming to your stop. http://goo.gl/Vcz1p
mobileAgent (for FreeAgent): get your accounts in your pocket.
http://goo.gl/IuBU
Trip Wallet: Keep track of your budget on the go: http://goo.gl/ePhKa
London Bike App: Find the nearest Boris Bike, and get riding! http://goo.gl/Icp2


More information about the MonoTouch mailing list