SlideShare a Scribd company logo
C# on the iPhone
with MonoTouch
        Chris Hardy
follow on Twitter - @chrisntr
http://greatfridays.com
Covering...

• What is MonoTouch?
• How does it work?
• Why would you use it?
• Demos
Starting point....
Objective C and Xcode
Learn to read Objective-C
Learn to read Objective-C

 • All Apple documentation is in Obj-C
 • Most examples are in Obj-C
 • It’s not too hard to understand
 • It might even be fun...
What is MonoTouch?
What is Mono?
What is Mono?

    Open Source .Net
  Implementation of the
Microsoft .Net Framework
Mono’s JIT Engine
             Memory

      Mono

CIL
Apple No No...
• Contractual Requirements
 • No interpreted code
 • No shared libraries

• Kernel Limitations
 • iPhone OS 2.0+ disables JIT
Mono’s AOT Engine
             Native
             Code

      Mono
      AOT      Mono Runtime


CIL
                        ARM
Monotouch Features
• mtouch
• MonoDevelop iPhone Add-In
• CocoaTouch.NET
• Full static AOT compiler
• Support for all your existing code
 • Reflection
 • Generics
 • LINQ
 • Anonymous Methods
 • Lambda’s etc...
MonoTouch’s APIs
The Bindings
• MonoTouch namespace
• MonoTouch.Foo namespace
 • Maps to CocoaTouch’s Foo Framework
• 1:1 Mapping of classes.
 • MonoTouch.UIKit.UILabel
 • CocoaTouch’s UIKit framework, UILabel
    class
Strong Types
• Objective-C
 • Arrays are weakly typed:
 • NSArray return values.
• MonoTouch has strong types
 • UIView[] Subviews { get; }
 • vs
 • NSArray *subviews;
• Intellisense - explore the API...
Garbage Collection
•   Automatic:
    •   Mono’s GC will collect objects on demand

•   Deterministic:
    •   Use when you need control.

    •   Every object in MonoTouch implements IDisposable
        using (var image = UIImage.FromFile(“foo.png”)){
            surface.DrawImage(image, 20, 20);
        }
Linker
What about App Size?

• 10 MB (compressed) limit on 3G/Edge
  downloads
• .Net BCL and other libraries are huge
• Mono Linker to the rescue!
Linking Assemblies
Linker Options

• No Link
• Link SDK Only
• Full Link
Pipeline

• Interface Builder GUI Designer
 • Exact same tool used by Xcode
 • Support for existing Xcode interfaces
• MonoDevelop IDE
Integration
• Tight integration between MD and IB
 • IB produces XIBs with MD parses
• Automatic class generation in MD
• Generates partial classes for all types,
  outlets and actions defined in Interface
  Builder
Outlets

• Instance Variables
• Can be strong or loosely typed
 • MD will strong type
Actions
• Objects emit broadcast messages to
  receivers
• You can do this C#
• MonoDevelop takes care of the details for
  you
• Creates partial methods for you extend
MonoTouch Events
• Supports Objective-C pattern:
 webView.Delegate = new
 MyWebViewDelegate();
• C# style events as well:
 webView.PageLoaded += delegate {
     HideSpinningWheel();
 }
Debugging


• Console.WriteLine(“Debugging inside of
  MonoTouch”);
• printf(“I made it to this line!n”)
Well...
• MonoTouch released around 15th
  September 2009
• MonoTouch 1.1 on 2nd October 2009
• MonoTouch 1.2 (Beta) released on 28th
  October 2009... With Debugging support
• Currently on MonoTouch 1.4.5
Debugger

• MonoTouch debugger leverages Mono’s
  new Soft-Debugger
• Supports the Simulator
• Supports the Device...
 • even over WiFi
Debugger Features
• Breakpoints
• Catchpoints
• Inspection
• Watches
• Immediate / Expression Evaluator
• Call Stack
• Stepping
Caveats

• Debug binaries on devices are very large
• Cannot debug Main or FinishedLaunching
  on device
• Consumes more memory runtime
• Performance hit
Getting started
• Get iPhone SDK from Apple
• Get Mono from Novell
• Get MonoTouch (evaluation version is free)
• Get MonoDevelop
• Register with Apple iPhone Developer
  Program and purchase MonoTouch for
  putting apps on device and AppStore.
One more thing...
iPad

• But you want to develop for the iPad...

• 24 Hours after the SDK was released...
• MonoTouch support for iPad
Demo time...
Q +A
twitter.com/chrisntr
chrisntr@gmail.com

More Related Content

PDF
Italian Alt.Net Conference MonoTouch Session
KEY
C# on the iPhone with MonoTouch Glasgow
PDF
Introduction to MonoTouch and Monodroid/Mono for Android
PPT
Plug-ins & Third-Party SDKs in UE4
PPTX
GDCE 2015: Blueprint Components to C++
PPTX
West Coast DevCon 2014: Engine Overview - A Programmers Glimpse at UE4
PPTX
Appium overview (Selenium Israel #2, Feb. 2014)
PPTX
Oleksandr Perepelytsya - saurce talk
Italian Alt.Net Conference MonoTouch Session
C# on the iPhone with MonoTouch Glasgow
Introduction to MonoTouch and Monodroid/Mono for Android
Plug-ins & Third-Party SDKs in UE4
GDCE 2015: Blueprint Components to C++
West Coast DevCon 2014: Engine Overview - A Programmers Glimpse at UE4
Appium overview (Selenium Israel #2, Feb. 2014)
Oleksandr Perepelytsya - saurce talk

What's hot (18)

KEY
Beginning iPhone Development
PPTX
GDC Europe 2014: Unreal Engine 4 for Programmers - Lessons Learned & Things t...
PPT
Lets Auto It
PPTX
Radu vunvulea building and testing windows 8 metro style applications using ...
PPTX
Intro to WebGL and BabylonJS
PPTX
FMX 2017: Extending Unreal Engine 4 with Plug-ins (Master Class)
PPTX
West Coast DevCon 2014: The Slate UI Framework (Part 2) - Game UI & Unreal Mo...
PPTX
Develop android application with mono for android
PDF
Pharo IoT Installation Improvements and Continuous Integration
PDF
From Unity3D to Unreal Engine 4
PPTX
ITS320 Presentation
PPTX
Java presetstion
PPTX
Its320 power point
PDF
How to modernise WPF and Windows Forms applications with Windows Apps SDK
PPTX
Java Class1
PPTX
PDE builds or Maven
PDF
PDF
OSVR Operating System Platforms and Portability
Beginning iPhone Development
GDC Europe 2014: Unreal Engine 4 for Programmers - Lessons Learned & Things t...
Lets Auto It
Radu vunvulea building and testing windows 8 metro style applications using ...
Intro to WebGL and BabylonJS
FMX 2017: Extending Unreal Engine 4 with Plug-ins (Master Class)
West Coast DevCon 2014: The Slate UI Framework (Part 2) - Game UI & Unreal Mo...
Develop android application with mono for android
Pharo IoT Installation Improvements and Continuous Integration
From Unity3D to Unreal Engine 4
ITS320 Presentation
Java presetstion
Its320 power point
How to modernise WPF and Windows Forms applications with Windows Apps SDK
Java Class1
PDE builds or Maven
OSVR Operating System Platforms and Portability
Ad

Similar to C# On The iPhone with MonoTouch at DDD8 (20)

PDF
Monotouch iPhone Development – IGDA Orlando - 2007
PPTX
Learning C# iPad Programming
PPTX
Introduction to MonoTouch
PPTX
A lap around monotouch
PPTX
EastBay.NET - Introduction to MonoTouch
PPTX
Mono touch 101
PPT
Cross-platform mobile dev with Mono
PPTX
Introduction to MonoTouch
KEY
Getting Started Using MonoTouch
ODP
OzAltNet Fast-ANDroid-furious
PDF
WP7, Droid, iPhone, Oh my!
PPT
OzAltNet Fast-ANDroid-furious
PDF
Mono for .NET Developers
PDF
Introduction to Cross Platform Development with Xamarin/ Visual Studio
PPTX
MonoTouch 5.2 Introduction
KEY
Intro to iPhone Development with MonoTouch
PDF
Mono for Android... for Google Devs
PPTX
What's new in Xamarin.iOS, by Miguel de Icaza
PPT
Intro to MonoTouch
PDF
Delphi Prism for iPhone/iPad and Linux with Mono and Monotouch
Monotouch iPhone Development – IGDA Orlando - 2007
Learning C# iPad Programming
Introduction to MonoTouch
A lap around monotouch
EastBay.NET - Introduction to MonoTouch
Mono touch 101
Cross-platform mobile dev with Mono
Introduction to MonoTouch
Getting Started Using MonoTouch
OzAltNet Fast-ANDroid-furious
WP7, Droid, iPhone, Oh my!
OzAltNet Fast-ANDroid-furious
Mono for .NET Developers
Introduction to Cross Platform Development with Xamarin/ Visual Studio
MonoTouch 5.2 Introduction
Intro to iPhone Development with MonoTouch
Mono for Android... for Google Devs
What's new in Xamarin.iOS, by Miguel de Icaza
Intro to MonoTouch
Delphi Prism for iPhone/iPad and Linux with Mono and Monotouch
Ad

Recently uploaded (20)

PPTX
observCloud-Native Containerability and monitoring.pptx
PDF
Getting started with AI Agents and Multi-Agent Systems
PDF
project resource management chapter-09.pdf
PDF
ENT215_Completing-a-large-scale-migration-and-modernization-with-AWS.pdf
PPTX
MicrosoftCybserSecurityReferenceArchitecture-April-2025.pptx
PDF
Zenith AI: Advanced Artificial Intelligence
PPTX
Final SEM Unit 1 for mit wpu at pune .pptx
PDF
NewMind AI Weekly Chronicles – August ’25 Week III
PPTX
O2C Customer Invoices to Receipt V15A.pptx
PPTX
OMC Textile Division Presentation 2021.pptx
PPT
What is a Computer? Input Devices /output devices
PDF
Transform Your ITIL® 4 & ITSM Strategy with AI in 2025.pdf
PDF
A contest of sentiment analysis: k-nearest neighbor versus neural network
PDF
A novel scalable deep ensemble learning framework for big data classification...
PDF
From MVP to Full-Scale Product A Startup’s Software Journey.pdf
PDF
2021 HotChips TSMC Packaging Technologies for Chiplets and 3D_0819 publish_pu...
PPTX
The various Industrial Revolutions .pptx
PDF
gpt5_lecture_notes_comprehensive_20250812015547.pdf
PDF
Hybrid model detection and classification of lung cancer
PDF
TrustArc Webinar - Click, Consent, Trust: Winning the Privacy Game
observCloud-Native Containerability and monitoring.pptx
Getting started with AI Agents and Multi-Agent Systems
project resource management chapter-09.pdf
ENT215_Completing-a-large-scale-migration-and-modernization-with-AWS.pdf
MicrosoftCybserSecurityReferenceArchitecture-April-2025.pptx
Zenith AI: Advanced Artificial Intelligence
Final SEM Unit 1 for mit wpu at pune .pptx
NewMind AI Weekly Chronicles – August ’25 Week III
O2C Customer Invoices to Receipt V15A.pptx
OMC Textile Division Presentation 2021.pptx
What is a Computer? Input Devices /output devices
Transform Your ITIL® 4 & ITSM Strategy with AI in 2025.pdf
A contest of sentiment analysis: k-nearest neighbor versus neural network
A novel scalable deep ensemble learning framework for big data classification...
From MVP to Full-Scale Product A Startup’s Software Journey.pdf
2021 HotChips TSMC Packaging Technologies for Chiplets and 3D_0819 publish_pu...
The various Industrial Revolutions .pptx
gpt5_lecture_notes_comprehensive_20250812015547.pdf
Hybrid model detection and classification of lung cancer
TrustArc Webinar - Click, Consent, Trust: Winning the Privacy Game

C# On The iPhone with MonoTouch at DDD8