Reputation: 8302
I am using Xamarin Studio with a MonoMac project. At the moment I am trying to get a custom view to appear in my main form but it doesn't seem to be working.
These are the steps that I went through:
Everything builds OK but my window is blank.
Is there anything obvious that I'm doing wrong?
Thanks, Alan
Upvotes: 0
Views: 347
Reputation: 12566
It seems the logical approach but it won't work. You can't design a .xib, and then embed that directly in another .xib (like you would with, say, Windows Forms controls).
For this to work, you need to:
Usually in Cocoa, you would use a ViewController to instantiate your test view instance, but it is not a requirement
this.Window.ContentView.ReplaceSubviewWith(this. myCustomViewPlaceHolder, new MyCustomViewController().View);
You may find this discussion helpful.
Upvotes: 2