Hi,
If you want to implement several protocols in one class, this is how you
have to do it:
[BaseType (typeof (NSObject))]
[Adopts (typeof (UITableViewDataSource)]
[Adopts (typeof (UITableViewDelegate)]
[Adopts (typeof (UIScrollViewDelegate)]
interface SCTableViewModel
{
[Export ("add:and")]
void Add (int a, int b);
}
IOW you have to add the AdoptsAttribute to the class, and then add Export
attributes for each method of the protocol you want to implement.
Here is a sample using AdoptsAttribute:
https://github.com/xamarin/monotouch-samples/blob/master/SimpleTextInput/EditableCoreTextView.cs
I hope this helps,
Rolf
On Fri, Nov 25, 2011 at 12:55 AM, Xy <[email protected]> wrote:
> After more debugging, I discovered that class SCTableViewModel is supposed
> to
> be implementing a few protocols:
> @interface SCTableViewModel : NSObject <UITableViewDataSource,
> UITableViewDelegate, UIScrollViewDelegate>
>
> So I tried to add the protocols to the C# binding:
> [BaseType (typeof (NSObject))]
> interface SCTableViewModel : UITableViewDataSource,
> UITableViewDelegate,
> UIScrollViewDelegate
>
> However, when I tried to build the api again, I get the errors below:
> api.cs(52,38): error CS0527: Type `MonoTouch.UIKit.UITableViewDataSource'
> in
> interface list is not an interface
> /Developer/MonoTouch/usr/lib/mono/2.1/monotouch.dll (Location of the symbol
> related to previous error)
> api.cs(52,61): error CS0527: Type `MonoTouch.UIKit.UITableViewDelegate' in
> interface list is not an interface
> /Developer/MonoTouch/usr/lib/mono/2.1/monotouch.dll (Location of the symbol
> related to previous error)
> api.cs(52,82): error CS0527: Type `MonoTouch.UIKit.UIScrollViewDelegate' in
> interface list is not an interface
>
> What is the correct way to do this? Suggestion would be appreciated.
>
> --
> View this message in context:
> http://monotouch.2284126.n4.nabble.com/Objective-C-protocol-binding-method-not-invoked-tp4105828p4105976.html
> Sent from the MonoTouch mailing list archive at Nabble.com.
> _______________________________________________
> MonoTouch mailing list
> [email protected]
> http://lists.ximian.com/mailman/listinfo/monotouch
>
_______________________________________________
MonoTouch mailing list
[email protected]
http://lists.ximian.com/mailman/listinfo/monotouch