Hmm, okay. This, right?<https://github.com/mono/monotouch-bindings/blob/master/MGSplitViewController/api.cs>That has the BaseType attribute, so so much for that theory.
Did you use btouch to build the DLL (cf. Miguel's Makefile), or just compile the project in MonoDevelop? The latter won't work as it doesn't generate the code that does the actual heavy lifting. But if you did, and it still doesn't work, it might be worth looking at the btouch generated classes (using --outdir=[some directory] --sourceonly=[file to list other generated files]) to make sure the partial class declaration for MGSplitViewController is correct. On Fri, May 20, 2011 at 12:09 PM, Michael Brian Bentley < [email protected]> wrote: > 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. > > Not sure about the inheritance problem -- have to see more of your code. I >> take it MGSplitViewController is a class you've written in Objective-C >> (extending UISplitViewController?) and then bound? As I said I haven't done >> this -- my AVUtils class doesn't (on the MT side) depend on extending >> NSObject. But the "< >> http://monotouch.net/Documentation/Binding_New_Objective-C_Types>Binding >> Objective-C Types" example includes a [BaseType] attribute on the interface; >> maybe that would help? >> >> >> Setting up your main window programmatically is pretty trivial -- though >> of course it also means programmatically adding UIViews to one another, >> setting their Frames, etc. But see Main.cs below: >> >> using System; >> >> using MonoTouch.Foundation; >> using MonoTouch.UIKit; >> >> namespace MyNamespace >> { >> public class Application >> { >> static void Main (string[] args) >> { >> try { >> UIApplication.Main (args, null, >> "AppDelegate"); >> } catch (Exception e) { >> Console.WriteLine(e); >> } >> } >> } >> >> [Register("AppDelegate")] >> public class AppDelegate : UIApplicationDelegate >> { >> UIWindow window; >> >> public override bool FinishedLaunching (UIApplication app, >> NSDictionary options) >> { >> window = new UIWindow(UIScreen.MainScreen.Bounds); >> >> // Add stuff to windowŠ >> >> window.MakeKeyAndVisible (); >> >> return true; >> >> } >> } >> } >> >> >> On Fri, May 20, 2011 at 11:36 AM, Michael Brian Bentley <<mailto: >> [email protected]>[email protected]> wrote: >> >> I'm not thrilled with using IB for this, but all the examples I've >> seen used a Xib for the main window so I stuck with that, and hadn't >> run into issues until this. Is it possible to set up the main >> programmatically then? >> >> >> >> I changed the namespace in the bindings to match the one used by most >> of the rest of the app, so I shouldn't have to add anything to the >> designer.cs file. >> >> It still complains about converting to that class from NSObject when I do: >> >> this.__mt_mgsplitViewController = >> ((MGSplitViewController)(this.GetNativeField("mgsplitViewController"))); >> >> in the stock property getter in the designer.cs file. It similarly >> says value can't be converted to NSObject in: >> >> this.SetNativeField("mgsplitViewController", value); >> >> While we're at it, it thinks SetNativeField and GetNativeField aren't >> defined either, so it doesn't grok that MGSplitViewController is >> derived from NSObject. >> >> I'm also wondering how I'm getting away with using "partial" in that >> mainwindow designer.cs generated file for MGSplitViewControler, the >> bindings do not include "partial". >> >> _______________________________________________ >> MonoTouch mailing list >> <mailto:[email protected]>[email protected] >> <http://lists.ximian.com/mailman/listinfo/monotouch> >> http://lists.ximian.com/mailman/listinfo/monotouch >> >> >> >> >> -- >> David Moles >> <mailto:[email protected]>[email protected] >> > > > -- David Moles [email protected]
_______________________________________________ MonoTouch mailing list [email protected] http://lists.ximian.com/mailman/listinfo/monotouch
