No problem. If you keep using IB, you're going to have a lot of partial
classes, though, so if you're new to C# you might want to read up on how
those work. :) Good luck!

On Fri, May 20, 2011 at 5:45 PM, Michael Brian Bentley <[email protected]
> wrote:

> I had to duck out for a demo/meeting with the client today, a couple
> hours ago, and so had to go prep something that worked :), I pulled
> out something a few days older and worked with that.
>
> I think I have the approach; I work on my own MySplitViewController
> class in IB and let MGSplitViewController be the stoic static
> superclass provided through bindings. Working with
> MGSplitViewController directly, the xib-associated design.cs was
> trying to extend, there were keywords like "partial" showing up
> Pairing a bound class with a subclass I define got me past the wall
> of compile errors.
>
> I'll conquer IB some day.
>
> Thanks!
>
> -Mike
>
> At 2:09 PM -0700 5/20/11, David Moles wrote:
> >When you say "defined it to be a subclass of MGSplitViewController",
> >you mean in IB? I think ordinarily you would add ":
> >MGSplitViewController" (by hand) in whatever (non-generated) file
> >defines the rest of the partial class.
> >
> >E.g., if you just create a new iPhone window project in MonoDevelop,
> >you get an AppDelegate class partially defined in
> >MainWindow.xib.designer.cs and partially defined in Main.cs; the ":
> >UIApplicationDelegate" is only in Main.cs.
> >
> >On Fri, May 20, 2011 at 12:35 PM, Michael Brian Bentley
> ><<mailto:[email protected]>[email protected]> wrote:
> >
> >
> >So I added MySplitViewController, defined it to be a subclass of
> >MGSplitViewController, noodled some connections in IB, saved and
> >built. It Complained about the same "can't convert between NSObject
> >and your class" thing. Then I added the ": MGSplitViewController"
> >reference below:
> >
> >[MonoTouch.Foundation.Register("MySplitViewController")]
> >public partial class MySplitViewController : MGSplitViewController {
> >
> >  private SpiffyDialogViewController __mt_delegate;
> >
> >  #pragma warning disable 0169
> >  [MonoTouch.Foundation.Connect("delegate")]
> >  private SpiffyDialogViewController @delegate {
> >    get {
> >        this.__mt_delegate =
> >
> ((SpiffyDialogViewController)(this.GetNativeField("delegate")));
> >        return this.__mt_delegate;
> >    }
> >    set {
> >        this.__mt_delegate = value;
> >        this.SetNativeField("delegate", value);
> >    }
> >  }
> >}
> >
> >Adding : MGSplitViewController fixed the error message.
> >
> >I do not understand why this is not being added by default, if I
> >tell IB there's a relationship between MySplitViewController and
> >MGSplitViewController, it should show up in the above generated code.
> >
> >-m
> >
> >Oh, wait. Hm.
> >
> >What if I defined in the xib MySplitViewController, and base that on
> >MGSplitViewController? And use IB to establish the inheritance
> >chain? That way the designer.cs file isn't trying to redefine or
> >extend a class defined by a set of bindings.
> >
> >Back inna sec...
> >
> >I didn't write it. MGSplitViewController is something that Matt
> >Gemmell wrote (it's up on GitHub), and someone else (Miguel?) wrote
> >a binding set for it (part of mono-monotouch-bindings also up on
> >GitHub). The ObjC project builds and works, so I created a project
> >that builds a .a for it, included the .a in the project using a
> >minimal mtouch command someone suggested, and built the dll for the
> >bindings and added that as a reference.
> >
> >I actually started to rewrite the objc project in C#, but I ran into
> >a bunch of issues and decided to try this instead. I'm not yet the
> >hot coder in either objc or C#, but now at least I have a better
> >idea how they're different.
> >
> >
> >
> >
> >
> >--
> >David Moles
> ><mailto:[email protected]>[email protected]
>
> _______________________________________________
> MonoTouch mailing list
> [email protected]
> http://lists.ximian.com/mailman/listinfo/monotouch
>



-- 
David Moles
[email protected]
_______________________________________________
MonoTouch mailing list
[email protected]
http://lists.ximian.com/mailman/listinfo/monotouch

Reply via email to