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 "Binding Objective-C
Types<http://monotouch.net/Documentation/Binding_New_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 <
[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
> [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