Sit back, relax, and enjoy the code.

I LOVE MonoTouch

Posted: January 24th, 2010 | Author: abel | Filed under: MonoTouch | Tags: , , | 1 Comment »

Don’t get me wrong, XCode is great…in it’s own way…but as a .Net dev coming to the iPhone platform, MonoTouch rocks my world!

For the other devs in my shoes looking to play with MonoTouch, here are some things to keep in mind:

  • If you want to subclass something like UIView, UIImageView, or any class that’s originally an Objective-C class & use your new class in your  XIB, you need to…
    • Make sure your constructor includes IntPtr constructor.
    • Sometimes you’ll need to register your classes like this:
      [MonoTouch.Foundation.Register("MyAwesomeView")]
      public class MyAwesomeView : UIView
      {
         public MyAwesomeView (IntPtr handle) : base(handle)
         {
            Initialize ();
         }
         //My awesome code here!
      }
      
    • If you simply type in the name of your custom subclassed view into IB without declaring it in code first, sometimes you get a “partial class” in the view controller’s xib code-behind file (MySensationalViewController.xib.designer.cs).  If that happens, you DON’T need to register your class, but you DO need to set your class definition to ‘partial’.  Here’s an example:
      public partial class MyFantasticView : UIView
      {
         public MyFantasticView  (IntPtr handle) : base(handle)
         {
            Initialize ();
         }
         //Your awesome code here!
      }
  • Much like Visual Studio, you get awesome debugging tools so make sure to get familiar with “watches” (While at  break point: View -> Debug Windows -> Watch) and the “Expression Evaluator” (While at  break point: Run -> Expression Evaluator).
  • There are also helpful tools such as a “Reg-Ex Toolkit” and an “Add-in” manager that can be hooked into repositories for even more functionality…as more repositories become available :)

When you have a friendly, yet powerful IDE to work with, developing software becomes enjoyable.  I’ll definitely be using this IDE to create my first iPhone app submission to the AppStore.  As I learn more about MonoTouch, I’ll make sure to post my findings here.  In the meanwhile, those of you looking to get more info about MonoTouch should checkout its homepage.  The MonoTouch site has a ton of tutorials, documentation, and multiple ways to plug into the MT community.  At a glance, you might scoff at the asking price of $399 for a yearly license, but when you consider how much faster you’ll be able to put together quality apps, it might be worth it for you.   I know it is for me.

Happy Coding!

  • Share/Bookmark

One Comment on “I LOVE MonoTouch”

  1. #1 MonoTouch.Info said at 11:41 pm on January 28th, 2010:

    Kickass Labs » Blog Archive » I LOVE MonoTouch…

    Thank you for submitting this entry – Trackback from MonoTouch.Info…


Leave a Reply