I looked at the Monotouch.dialog stuff and it’s pretty awesome. However, it has some limitations. I was hoping to be able to create my app without having to use Xib files, but I’m not sure how to do that. Without MonoTouch dialog and xib files…. I don’t know any other way.
Could anyone point in the right direction?
I didn’t know how to do this for the longest time, but it’s simpler than you would think! Just add a regular C# class (you don’t need to use any of the special templates), import the MonoTouch.Foundation and MonoTouch.UIKit namespaces, and make your new class a subclass of UIViewController.
It’s that simple! You’ll want to override the usual methods like ViewDidLoad, but that should be enough to get you started. As far as implementing a UI without using a .xib, just create everything programatically, set the frame, and add it to the view (and of course customize it with properties/methods and such)!
You would set it up something like:
The hardest part of doing this is getting the frame and everything setup (imo).
There is also some real-life code of not using .xibs and using MonoTouch.Dialog at the Github page for TweetStation. https://github.com/migueldeicaza/TweetStation/blob/master/TweetStation/Dialogs/Settings.cs
In the Xamarin Forums, there is a post detailing some more examples of using purely C# code (no .xibs) that is very helpful!