LEARNING    IPAD     C#PROGRAMMING  (REV 001)                   Rich Helton        Rhelton_1@yahoo.com               Augus...
What is MonoDevelop?• MonoDevelop is an open source integrated  development environment for the Linux  platform, MAC OS X,...
What is Mono?• Mono is a free open source project led by  Xamerin (formally Novell and originally by  Ximian) to create an...
Mono end-to-end• Mono is a series of wrappers around  Android, Mac, iOS, and more.• There is the base Mono framework, the ...
Still iOS• iOS is the operating system for the iPhone,  iPod, and iPad.• We cannot escape learning bits of iOS by  focusin...
MonoGame• MonoGame is an Open Source  implementation of the Microsoft XNA 4  Framework.• This allows us to build games in ...
XNA• Microsoft’s XNA is a set of tools with a  managed runtime environment provided by  Microsoft that facilitates video g...
MonoMac• MonoMac is the Mac OSX, not iOS, binding to  .NET in Mono.• By using MonoMac and MonoGame, XNA/C#  games can be w...
MonoMac Sample• A MonoMac sample for WhereisMyMac has  geolocated my Mac and me.
What is MonoTouch?• MonoTouch allows developers to create C#  and .NET based application that run on the  IPhone.• http://...
How does MonoTouch work?• The MonoTouch platform compiles directly to  the ARM assembly code.• Even things like generics, ...
Default Assemblies• There are many default assemblies in  MonoTouch, many in support of  XML, Linq, WCF, SQLite, Sockets a...
There are many Apps in the App Store• There are many Apps from MonoTouch in the  App Store, but there is always a concern ...
There are many Samples• https://github.com/xamarin/MonoTouch-  samples• http://samples.xamarin.com/iOS• https://bitbucket....
MONODEVELOP    IS NOTVISUAL STUDIO
There are many differences• Just because something supports .Net 4, it  doesn’t mean it supports Visual Studio 2010  funct...
There are many differences• For Instance, I can set up a Test Project for  Visual Studio Test,
There are limitations• Besides some of the Visual Studio plugins and  extensions, MonoTouch does have C#  language limitat...
INSTALLATION
You can play for free• An evaluation version of MonoTouch can be  used in the iPad simulator for the MAC  OSX, but a licen...
You can play for free• An evaluation version of MonoTouch can be  used in the iPad simulator for the MAC  OSX, but a licen...
Install…•   Ensure Xcode is installed.•   Install the Mono Framework•   Install MonoDevelop•   Install MonoTouch
Ensure that Xcode is installed• Install the correct Xcode for the MAC  OSX, get Xcode from  https://developer.apple.com/de...
Install Mono• Install mono SDK from http://www.go-  mono.com/mono-downloads/download.html• Install the MonoDevelop from  h...
MVC
Model-View-Controller (MVC) The Model-View-Controller is the mostcommon design pattern in SoftwareArchitecture. There is...
Model-View-Controller (MVC)• Here are the pieces:
UIKit MVC Microsoft’s MVC3 project is a ASP.NETimplementation of MVC. For the iPad MVC, the iOS UIKIT will have tobe use...
An MVC Example Microsoft’s MVC3 project is a ASP.NETimplementation of MVC. For the iPad MVC, the iOS UIKIT will have to ...
AppDelegate One of the classes defined in the UIKit is theAppDelegate which is automatically defined inall MonoTouch proj...
AppDelegate functions Normally, there will be a function namedFinishedLaunching that will have“window.makeKeyAnd” that wi...
AppDelegate example
Other DelegatesiOS contains other delegates that are used topass information between the application and OS. Examples ar...
UIViewUIView is the base class that contain all thescreen elements and properties to be managedby the UIViewController. ...
Some UIView subclasses
Notice that Interface Builder matches UIKit
UIViewController A default controller that controls the view. It comes with a lifecycle for functions tocheck if the Vie...
UIViewController->ViewDidLoadViewDidLoad is very important because afterthe View loads, then many of the pieces areadded ...
Starting with Controllers Many controllers will be derived from theUIKitUIViewController for the main UI View. Some exam...
Starting with Controllers Many controllers will be derived from theUIKitUIViewController for the main UI View. Some exam...
NIB File The NIB file is the compiled set of XIBfiles, the XML, for the App. It will be packaged in the deployed App.ht...
XIB File There are many XML file formats to helpgenerate GUI’s, for example in Microsofts WPF,there is the XAML file form...
XIB Code Generationhttp://docs.xamarin.com/iOS/advanced_topics/xib_code_generation
Interface Builder The XIB file can be managed in Xcode’sInterface Builder.Seehttp://en.wikipedia.org/wiki/Interface_Buil...
Outlets An outlet connects Interface Builder to thecode. It is is the plumbing for the code behind forthe MonoTouch to O...
Adding an Outlet An outlet can be added in the Interface Builder(IB) or programmatically. It can be added to the AppDele...
Actions Actions in Objective-C are equivalent tocontrol events in C#. Actions deliver notification signals to variousobj...
Adding an Action An action can be added in the Interface Builder(IB) or programmatically. The IB will generate action co...
FIRST APP
MonoDevelop->New->Solution
Many pieces are created The AppDelegate.cs, Main.cs, defaultControllers, and default XIBs are created now. The iPad appl...
Many pieces are created
Code was generated The AppDelegate.cs and Main.cs weregenerated to start the application. For the main screen, aMainView...
Run-> Start Debugging(iPad Simulator Launches)
The showInfo Action will call the showInfofunction, calling the FlipsController
We can see showInfo Action andMainController in the XIB view
Double Click ->FlipsideViewController.xib(Xcode Interface Builder Launches)
Add a Label
Run again, now it has a Label
There was a “done” button, notice the Action for done in thecode behind and the function in the Controller
Some notes … We just changed theFlipsideViewController.xib, which may updatethe interface to the FlipSideViewController w...
This also means that the label is in theXIB code and the object is embedded
Let’s add a label programmatically inViewDidLoad
Executing it, we see the new(HomeView) label.
ADDING AVIEW
Add a ViewController to the Project
Which creates a default template for both thecontroller and XIB.
And an empty XIB that works as the View
Xamarim Recipe for Add a New View
Running the Add New View
MONOTOUCH.DIALOG
IntroMonoTouch.dialog is a framework forMonoTouch that can be found athttps://github.com/migueldeicaza/MonoTouch.Dialog ...
Many Demo Apps
Switching it to iPad
Demos in iPad
Xamarin offers a Tutorial
MonoTouch Elements(Extended classes of MonoTouch.Dialog)
MonoTouch Elements Running
Xamarin Elements Tutorial
Xamarin Reflections Tutorial
Running Reflections Tutorial
Reflections Tutorial Notes• Notice that there is no XIB file or Controller  class.• There is a decorated class with the at...
Set the values for the Dialog
Create the Controller Flow for the Dialog in theAppDelegate
WORKINGWITH TABLESAND CELLS
Tables and Cells Intro• UITableView is the most common layout and  data display tool in iOS.• A normal display could be si...
Xamarin Tutorial
Running the Basic Table
Running the Table Edit Mode
INTRO TOSTORYBOARDS
Storyboards -- Apple• In iOS5, Apple introduced a concept called  Storyboards.• A Storyboard is a visual representation of...
Storyboards -- MonoTouch• Xamarin offers a Tutorial and sample code for  a Storyboard.• See  http://docs.xamarin.com/ios/t...
Storyboards – The sample• The sample will show  Controllers, AppDelegate, plist, and Main as  normal, but there is a also ...
The Storyboard file in Xcode
Storyboards -- segue• The segue manages the transitions between  the scenes and passes data with a “sender”.
Storyboards -- dock• The dock is used to define outlets and actions  between the view controller and views.
Storyboards -- dock• The iPad can have multiple scenes appear at  once, but the scene is similar to a View.
Running the sample shows navigation
COMMANDSAND TOOLS
mono has several command line tools
mtouch Commands
Multiple IDE’s• Multiple MonoDevoleps can be run on Mac  OSX with “open -n  /Applications/MonoDevelop.app”• See  http://mi...
MonoTouch Profiler
CONCLUSION
Upcoming SlideShare
Loading in …5
×

Learning C# iPad Programming

3,908 views

Published on

Building IPAD Apps in MonoTouch

Published in: Technology
0 Comments
1 Like
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total views
3,908
On SlideShare
0
From Embeds
0
Number of Embeds
4
Actions
Shares
0
Downloads
47
Comments
0
Likes
1
Embeds 0
No embeds

No notes for slide
  • This template can be used as a starter file for presenting training materials in a group setting.SectionsRight-click on a slide to add sections. Sections can help to organize your slides or facilitate collaboration between multiple authors.NotesUse the Notes section for delivery notes or to provide additional details for the audience. View these notes in Presentation View during your presentation. Keep in mind the font size (important for accessibility, visibility, videotaping, and online production)Coordinated colors Pay particular attention to the graphs, charts, and text boxes.Consider that attendees will print in black and white or grayscale. Run a test print to make sure your colors work when printed in pure black and white and grayscale.Graphics, tables, and graphsKeep it simple: If possible, use consistent, non-distracting styles and colors.Label all graphs and tables.
  • Give a brief overview of the presentation. Describe the major focus of the presentation and why it is important.Introduce each of the major topics.To provide a road map for the audience, you can repeat this Overview slide throughout the presentation, highlighting the particular topic you will discuss next.
  • Give a brief overview of the presentation. Describe the major focus of the presentation and why it is important.Introduce each of the major topics.To provide a road map for the audience, you can repeat this Overview slide throughout the presentation, highlighting the particular topic you will discuss next.
  • Give a brief overview of the presentation. Describe the major focus of the presentation and why it is important.Introduce each of the major topics.To provide a road map for the audience, you can repeat this Overview slide throughout the presentation, highlighting the particular topic you will discuss next.
  • Give a brief overview of the presentation. Describe the major focus of the presentation and why it is important.Introduce each of the major topics.To provide a road map for the audience, you can repeat this Overview slide throughout the presentation, highlighting the particular topic you will discuss next.
  • Give a brief overview of the presentation. Describe the major focus of the presentation and why it is important.Introduce each of the major topics.To provide a road map for the audience, you can repeat this Overview slide throughout the presentation, highlighting the particular topic you will discuss next.
  • Give a brief overview of the presentation. Describe the major focus of the presentation and why it is important.Introduce each of the major topics.To provide a road map for the audience, you can repeat this Overview slide throughout the presentation, highlighting the particular topic you will discuss next.
  • Give a brief overview of the presentation. Describe the major focus of the presentation and why it is important.Introduce each of the major topics.To provide a road map for the audience, you can repeat this Overview slide throughout the presentation, highlighting the particular topic you will discuss next.
  • Give a brief overview of the presentation. Describe the major focus of the presentation and why it is important.Introduce each of the major topics.To provide a road map for the audience, you can repeat this Overview slide throughout the presentation, highlighting the particular topic you will discuss next.
  • Give a brief overview of the presentation. Describe the major focus of the presentation and why it is important.Introduce each of the major topics.To provide a road map for the audience, you can repeat this Overview slide throughout the presentation, highlighting the particular topic you will discuss next.
  • Give a brief overview of the presentation. Describe the major focus of the presentation and why it is important.Introduce each of the major topics.To provide a road map for the audience, you can repeat this Overview slide throughout the presentation, highlighting the particular topic you will discuss next.
  • Give a brief overview of the presentation. Describe the major focus of the presentation and why it is important.Introduce each of the major topics.To provide a road map for the audience, you can repeat this Overview slide throughout the presentation, highlighting the particular topic you will discuss next.
  • Give a brief overview of the presentation. Describe the major focus of the presentation and why it is important.Introduce each of the major topics.To provide a road map for the audience, you can repeat this Overview slide throughout the presentation, highlighting the particular topic you will discuss next.
  • Give a brief overview of the presentation. Describe the major focus of the presentation and why it is important.Introduce each of the major topics.To provide a road map for the audience, you can repeat this Overview slide throughout the presentation, highlighting the particular topic you will discuss next.
  • Give a brief overview of the presentation. Describe the major focus of the presentation and why it is important.Introduce each of the major topics.To provide a road map for the audience, you can repeat this Overview slide throughout the presentation, highlighting the particular topic you will discuss next.
  • Give a brief overview of the presentation. Describe the major focus of the presentation and why it is important.Introduce each of the major topics.To provide a road map for the audience, you can repeat this Overview slide throughout the presentation, highlighting the particular topic you will discuss next.
  • Give a brief overview of the presentation. Describe the major focus of the presentation and why it is important.Introduce each of the major topics.To provide a road map for the audience, you can repeat this Overview slide throughout the presentation, highlighting the particular topic you will discuss next.
  • Give a brief overview of the presentation. Describe the major focus of the presentation and why it is important.Introduce each of the major topics.To provide a road map for the audience, you can repeat this Overview slide throughout the presentation, highlighting the particular topic you will discuss next.
  • Give a brief overview of the presentation. Describe the major focus of the presentation and why it is important.Introduce each of the major topics.To provide a road map for the audience, you can repeat this Overview slide throughout the presentation, highlighting the particular topic you will discuss next.
  • Give a brief overview of the presentation. Describe the major focus of the presentation and why it is important.Introduce each of the major topics.To provide a road map for the audience, you can repeat this Overview slide throughout the presentation, highlighting the particular topic you will discuss next.
  • Give a brief overview of the presentation. Describe the major focus of the presentation and why it is important.Introduce each of the major topics.To provide a road map for the audience, you can repeat this Overview slide throughout the presentation, highlighting the particular topic you will discuss next.
  • Give a brief overview of the presentation. Describe the major focus of the presentation and why it is important.Introduce each of the major topics.To provide a road map for the audience, you can repeat this Overview slide throughout the presentation, highlighting the particular topic you will discuss next.
  • Give a brief overview of the presentation. Describe the major focus of the presentation and why it is important.Introduce each of the major topics.To provide a road map for the audience, you can repeat this Overview slide throughout the presentation, highlighting the particular topic you will discuss next.
  • Give a brief overview of the presentation. Describe the major focus of the presentation and why it is important.Introduce each of the major topics.To provide a road map for the audience, you can repeat this Overview slide throughout the presentation, highlighting the particular topic you will discuss next.
  • Give a brief overview of the presentation. Describe the major focus of the presentation and why it is important.Introduce each of the major topics.To provide a road map for the audience, you can repeat this Overview slide throughout the presentation, highlighting the particular topic you will discuss next.
  • Give a brief overview of the presentation. Describe the major focus of the presentation and why it is important.Introduce each of the major topics.To provide a road map for the audience, you can repeat this Overview slide throughout the presentation, highlighting the particular topic you will discuss next.
  • Give a brief overview of the presentation. Describe the major focus of the presentation and why it is important.Introduce each of the major topics.To provide a road map for the audience, you can repeat this Overview slide throughout the presentation, highlighting the particular topic you will discuss next.
  • Give a brief overview of the presentation. Describe the major focus of the presentation and why it is important.Introduce each of the major topics.To provide a road map for the audience, you can repeat this Overview slide throughout the presentation, highlighting the particular topic you will discuss next.
  • Give a brief overview of the presentation. Describe the major focus of the presentation and why it is important.Introduce each of the major topics.To provide a road map for the audience, you can repeat this Overview slide throughout the presentation, highlighting the particular topic you will discuss next.
  • Give a brief overview of the presentation. Describe the major focus of the presentation and why it is important.Introduce each of the major topics.To provide a road map for the audience, you can repeat this Overview slide throughout the presentation, highlighting the particular topic you will discuss next.
  • Give a brief overview of the presentation. Describe the major focus of the presentation and why it is important.Introduce each of the major topics.To provide a road map for the audience, you can repeat this Overview slide throughout the presentation, highlighting the particular topic you will discuss next.
  • Give a brief overview of the presentation. Describe the major focus of the presentation and why it is important.Introduce each of the major topics.To provide a road map for the audience, you can repeat this Overview slide throughout the presentation, highlighting the particular topic you will discuss next.
  • Give a brief overview of the presentation. Describe the major focus of the presentation and why it is important.Introduce each of the major topics.To provide a road map for the audience, you can repeat this Overview slide throughout the presentation, highlighting the particular topic you will discuss next.
  • Give a brief overview of the presentation. Describe the major focus of the presentation and why it is important.Introduce each of the major topics.To provide a road map for the audience, you can repeat this Overview slide throughout the presentation, highlighting the particular topic you will discuss next.
  • Give a brief overview of the presentation. Describe the major focus of the presentation and why it is important.Introduce each of the major topics.To provide a road map for the audience, you can repeat this Overview slide throughout the presentation, highlighting the particular topic you will discuss next.
  • Give a brief overview of the presentation. Describe the major focus of the presentation and why it is important.Introduce each of the major topics.To provide a road map for the audience, you can repeat this Overview slide throughout the presentation, highlighting the particular topic you will discuss next.
  • Give a brief overview of the presentation. Describe the major focus of the presentation and why it is important.Introduce each of the major topics.To provide a road map for the audience, you can repeat this Overview slide throughout the presentation, highlighting the particular topic you will discuss next.
  • Give a brief overview of the presentation. Describe the major focus of the presentation and why it is important.Introduce each of the major topics.To provide a road map for the audience, you can repeat this Overview slide throughout the presentation, highlighting the particular topic you will discuss next.
  • Give a brief overview of the presentation. Describe the major focus of the presentation and why it is important.Introduce each of the major topics.To provide a road map for the audience, you can repeat this Overview slide throughout the presentation, highlighting the particular topic you will discuss next.
  • Give a brief overview of the presentation. Describe the major focus of the presentation and why it is important.Introduce each of the major topics.To provide a road map for the audience, you can repeat this Overview slide throughout the presentation, highlighting the particular topic you will discuss next.
  • Give a brief overview of the presentation. Describe the major focus of the presentation and why it is important.Introduce each of the major topics.To provide a road map for the audience, you can repeat this Overview slide throughout the presentation, highlighting the particular topic you will discuss next.
  • Give a brief overview of the presentation. Describe the major focus of the presentation and why it is important.Introduce each of the major topics.To provide a road map for the audience, you can repeat this Overview slide throughout the presentation, highlighting the particular topic you will discuss next.
  • Give a brief overview of the presentation. Describe the major focus of the presentation and why it is important.Introduce each of the major topics.To provide a road map for the audience, you can repeat this Overview slide throughout the presentation, highlighting the particular topic you will discuss next.
  • Give a brief overview of the presentation. Describe the major focus of the presentation and why it is important.Introduce each of the major topics.To provide a road map for the audience, you can repeat this Overview slide throughout the presentation, highlighting the particular topic you will discuss next.
  • Give a brief overview of the presentation. Describe the major focus of the presentation and why it is important.Introduce each of the major topics.To provide a road map for the audience, you can repeat this Overview slide throughout the presentation, highlighting the particular topic you will discuss next.
  • Give a brief overview of the presentation. Describe the major focus of the presentation and why it is important.Introduce each of the major topics.To provide a road map for the audience, you can repeat this Overview slide throughout the presentation, highlighting the particular topic you will discuss next.
  • Give a brief overview of the presentation. Describe the major focus of the presentation and why it is important.Introduce each of the major topics.To provide a road map for the audience, you can repeat this Overview slide throughout the presentation, highlighting the particular topic you will discuss next.
  • Give a brief overview of the presentation. Describe the major focus of the presentation and why it is important.Introduce each of the major topics.To provide a road map for the audience, you can repeat this Overview slide throughout the presentation, highlighting the particular topic you will discuss next.
  • Give a brief overview of the presentation. Describe the major focus of the presentation and why it is important.Introduce each of the major topics.To provide a road map for the audience, you can repeat this Overview slide throughout the presentation, highlighting the particular topic you will discuss next.
  • Give a brief overview of the presentation. Describe the major focus of the presentation and why it is important.Introduce each of the major topics.To provide a road map for the audience, you can repeat this Overview slide throughout the presentation, highlighting the particular topic you will discuss next.
  • Give a brief overview of the presentation. Describe the major focus of the presentation and why it is important.Introduce each of the major topics.To provide a road map for the audience, you can repeat this Overview slide throughout the presentation, highlighting the particular topic you will discuss next.
  • Give a brief overview of the presentation. Describe the major focus of the presentation and why it is important.Introduce each of the major topics.To provide a road map for the audience, you can repeat this Overview slide throughout the presentation, highlighting the particular topic you will discuss next.
  • Give a brief overview of the presentation. Describe the major focus of the presentation and why it is important.Introduce each of the major topics.To provide a road map for the audience, you can repeat this Overview slide throughout the presentation, highlighting the particular topic you will discuss next.
  • Give a brief overview of the presentation. Describe the major focus of the presentation and why it is important.Introduce each of the major topics.To provide a road map for the audience, you can repeat this Overview slide throughout the presentation, highlighting the particular topic you will discuss next.
  • Give a brief overview of the presentation. Describe the major focus of the presentation and why it is important.Introduce each of the major topics.To provide a road map for the audience, you can repeat this Overview slide throughout the presentation, highlighting the particular topic you will discuss next.
  • Give a brief overview of the presentation. Describe the major focus of the presentation and why it is important.Introduce each of the major topics.To provide a road map for the audience, you can repeat this Overview slide throughout the presentation, highlighting the particular topic you will discuss next.
  • Give a brief overview of the presentation. Describe the major focus of the presentation and why it is important.Introduce each of the major topics.To provide a road map for the audience, you can repeat this Overview slide throughout the presentation, highlighting the particular topic you will discuss next.
  • Give a brief overview of the presentation. Describe the major focus of the presentation and why it is important.Introduce each of the major topics.To provide a road map for the audience, you can repeat this Overview slide throughout the presentation, highlighting the particular topic you will discuss next.
  • Give a brief overview of the presentation. Describe the major focus of the presentation and why it is important.Introduce each of the major topics.To provide a road map for the audience, you can repeat this Overview slide throughout the presentation, highlighting the particular topic you will discuss next.
  • Give a brief overview of the presentation. Describe the major focus of the presentation and why it is important.Introduce each of the major topics.To provide a road map for the audience, you can repeat this Overview slide throughout the presentation, highlighting the particular topic you will discuss next.
  • Give a brief overview of the presentation. Describe the major focus of the presentation and why it is important.Introduce each of the major topics.To provide a road map for the audience, you can repeat this Overview slide throughout the presentation, highlighting the particular topic you will discuss next.
  • Give a brief overview of the presentation. Describe the major focus of the presentation and why it is important.Introduce each of the major topics.To provide a road map for the audience, you can repeat this Overview slide throughout the presentation, highlighting the particular topic you will discuss next.
  • Give a brief overview of the presentation. Describe the major focus of the presentation and why it is important.Introduce each of the major topics.To provide a road map for the audience, you can repeat this Overview slide throughout the presentation, highlighting the particular topic you will discuss next.
  • Give a brief overview of the presentation. Describe the major focus of the presentation and why it is important.Introduce each of the major topics.To provide a road map for the audience, you can repeat this Overview slide throughout the presentation, highlighting the particular topic you will discuss next.
  • Give a brief overview of the presentation. Describe the major focus of the presentation and why it is important.Introduce each of the major topics.To provide a road map for the audience, you can repeat this Overview slide throughout the presentation, highlighting the particular topic you will discuss next.
  • Give a brief overview of the presentation. Describe the major focus of the presentation and why it is important.Introduce each of the major topics.To provide a road map for the audience, you can repeat this Overview slide throughout the presentation, highlighting the particular topic you will discuss next.
  • Give a brief overview of the presentation. Describe the major focus of the presentation and why it is important.Introduce each of the major topics.To provide a road map for the audience, you can repeat this Overview slide throughout the presentation, highlighting the particular topic you will discuss next.
  • Give a brief overview of the presentation. Describe the major focus of the presentation and why it is important.Introduce each of the major topics.To provide a road map for the audience, you can repeat this Overview slide throughout the presentation, highlighting the particular topic you will discuss next.
  • Give a brief overview of the presentation. Describe the major focus of the presentation and why it is important.Introduce each of the major topics.To provide a road map for the audience, you can repeat this Overview slide throughout the presentation, highlighting the particular topic you will discuss next.
  • Give a brief overview of the presentation. Describe the major focus of the presentation and why it is important.Introduce each of the major topics.To provide a road map for the audience, you can repeat this Overview slide throughout the presentation, highlighting the particular topic you will discuss next.
  • Give a brief overview of the presentation. Describe the major focus of the presentation and why it is important.Introduce each of the major topics.To provide a road map for the audience, you can repeat this Overview slide throughout the presentation, highlighting the particular topic you will discuss next.
  • Give a brief overview of the presentation. Describe the major focus of the presentation and why it is important.Introduce each of the major topics.To provide a road map for the audience, you can repeat this Overview slide throughout the presentation, highlighting the particular topic you will discuss next.
  • Give a brief overview of the presentation. Describe the major focus of the presentation and why it is important.Introduce each of the major topics.To provide a road map for the audience, you can repeat this Overview slide throughout the presentation, highlighting the particular topic you will discuss next.
  • Give a brief overview of the presentation. Describe the major focus of the presentation and why it is important.Introduce each of the major topics.To provide a road map for the audience, you can repeat this Overview slide throughout the presentation, highlighting the particular topic you will discuss next.
  • Give a brief overview of the presentation. Describe the major focus of the presentation and why it is important.Introduce each of the major topics.To provide a road map for the audience, you can repeat this Overview slide throughout the presentation, highlighting the particular topic you will discuss next.
  • Give a brief overview of the presentation. Describe the major focus of the presentation and why it is important.Introduce each of the major topics.To provide a road map for the audience, you can repeat this Overview slide throughout the presentation, highlighting the particular topic you will discuss next.
  • Give a brief overview of the presentation. Describe the major focus of the presentation and why it is important.Introduce each of the major topics.To provide a road map for the audience, you can repeat this Overview slide throughout the presentation, highlighting the particular topic you will discuss next.
  • Give a brief overview of the presentation. Describe the major focus of the presentation and why it is important.Introduce each of the major topics.To provide a road map for the audience, you can repeat this Overview slide throughout the presentation, highlighting the particular topic you will discuss next.
  • Give a brief overview of the presentation. Describe the major focus of the presentation and why it is important.Introduce each of the major topics.To provide a road map for the audience, you can repeat this Overview slide throughout the presentation, highlighting the particular topic you will discuss next.
  • Give a brief overview of the presentation. Describe the major focus of the presentation and why it is important.Introduce each of the major topics.To provide a road map for the audience, you can repeat this Overview slide throughout the presentation, highlighting the particular topic you will discuss next.
  • Give a brief overview of the presentation. Describe the major focus of the presentation and why it is important.Introduce each of the major topics.To provide a road map for the audience, you can repeat this Overview slide throughout the presentation, highlighting the particular topic you will discuss next.
  • Give a brief overview of the presentation. Describe the major focus of the presentation and why it is important.Introduce each of the major topics.To provide a road map for the audience, you can repeat this Overview slide throughout the presentation, highlighting the particular topic you will discuss next.
  • Give a brief overview of the presentation. Describe the major focus of the presentation and why it is important.Introduce each of the major topics.To provide a road map for the audience, you can repeat this Overview slide throughout the presentation, highlighting the particular topic you will discuss next.
  • Give a brief overview of the presentation. Describe the major focus of the presentation and why it is important.Introduce each of the major topics.To provide a road map for the audience, you can repeat this Overview slide throughout the presentation, highlighting the particular topic you will discuss next.
  • Give a brief overview of the presentation. Describe the major focus of the presentation and why it is important.Introduce each of the major topics.To provide a road map for the audience, you can repeat this Overview slide throughout the presentation, highlighting the particular topic you will discuss next.
  • Give a brief overview of the presentation. Describe the major focus of the presentation and why it is important.Introduce each of the major topics.To provide a road map for the audience, you can repeat this Overview slide throughout the presentation, highlighting the particular topic you will discuss next.
  • Give a brief overview of the presentation. Describe the major focus of the presentation and why it is important.Introduce each of the major topics.To provide a road map for the audience, you can repeat this Overview slide throughout the presentation, highlighting the particular topic you will discuss next.
  • Give a brief overview of the presentation. Describe the major focus of the presentation and why it is important.Introduce each of the major topics.To provide a road map for the audience, you can repeat this Overview slide throughout the presentation, highlighting the particular topic you will discuss next.
  • Give a brief overview of the presentation. Describe the major focus of the presentation and why it is important.Introduce each of the major topics.To provide a road map for the audience, you can repeat this Overview slide throughout the presentation, highlighting the particular topic you will discuss next.
  • Give a brief overview of the presentation. Describe the major focus of the presentation and why it is important.Introduce each of the major topics.To provide a road map for the audience, you can repeat this Overview slide throughout the presentation, highlighting the particular topic you will discuss next.
  • Give a brief overview of the presentation. Describe the major focus of the presentation and why it is important.Introduce each of the major topics.To provide a road map for the audience, you can repeat this Overview slide throughout the presentation, highlighting the particular topic you will discuss next.
  • Give a brief overview of the presentation. Describe the major focus of the presentation and why it is important.Introduce each of the major topics.To provide a road map for the audience, you can repeat this Overview slide throughout the presentation, highlighting the particular topic you will discuss next.
  • Give a brief overview of the presentation. Describe the major focus of the presentation and why it is important.Introduce each of the major topics.To provide a road map for the audience, you can repeat this Overview slide throughout the presentation, highlighting the particular topic you will discuss next.
  • Give a brief overview of the presentation. Describe the major focus of the presentation and why it is important.Introduce each of the major topics.To provide a road map for the audience, you can repeat this Overview slide throughout the presentation, highlighting the particular topic you will discuss next.
  • Learning C# iPad Programming

    1. 1. LEARNING IPAD C#PROGRAMMING (REV 001) Rich Helton Rhelton_1@yahoo.com August 28, 2012
    2. 2. What is MonoDevelop?• MonoDevelop is an open source integrated development environment for the Linux platform, MAC OS X, and Microsoft Windows, targeted for the development of software that uses Mono and the Micorosft .NET frameworks.• See http://en.wikipedia.org/wiki/MonoDevelop
    3. 3. What is Mono?• Mono is a free open source project led by Xamerin (formally Novell and originally by Ximian) to create an Ecma standard compliant .Net framework-compatible set of tools including, among others, a C# compiler and Common Runtime Language.• See http://en.wikipedia.org/wiki/Mono_(software)• See http://www.mono-project.com/Main_Page
    4. 4. Mono end-to-end• Mono is a series of wrappers around Android, Mac, iOS, and more.• There is the base Mono framework, the IDE, and MonoTouch is the framework for compiling on the iPad device.• Pieces of code can be reused for other Mono frameworks.• Just to get MAC diagnostics written in C# is enough to get me looking into it.
    5. 5. Still iOS• iOS is the operating system for the iPhone, iPod, and iPad.• We cannot escape learning bits of iOS by focusing on Mono, because Mono is a wrapper around iOS, but it helps us focus on the C# frameworks instead of getting lost in iOS.• Mono allows us to use C# frameworks around iOS and other operating systems.
    6. 6. MonoGame• MonoGame is an Open Source implementation of the Microsoft XNA 4 Framework.• This allows us to build games in XNA for the iPad.• http://monogame.codeplex.com/
    7. 7. XNA• Microsoft’s XNA is a set of tools with a managed runtime environment provided by Microsoft that facilitates video game development and management.• http://en.wikipedia.org/wiki/Microsoft_XNA
    8. 8. MonoMac• MonoMac is the Mac OSX, not iOS, binding to .NET in Mono.• By using MonoMac and MonoGame, XNA/C# games can be written for the Mac OSX, like Lion.• http://www.mono-project.com/MonoMac
    9. 9. MonoMac Sample• A MonoMac sample for WhereisMyMac has geolocated my Mac and me.
    10. 10. What is MonoTouch?• MonoTouch allows developers to create C# and .NET based application that run on the IPhone.• http://en.wikipedia.org/wiki/MonoTouch#M onoTouch• There is a cost for licenses.• https://store.xamarin.com/
    11. 11. How does MonoTouch work?• The MonoTouch platform compiles directly to the ARM assembly code.• Even things like generics, which used to rely on Just In Time (JIT) compilation are available via Mono’s Ahead Of Time (AOT) compiler.• http://docs.xamarin.com/iOS/getting_started /Introduction_to_MonoTouch#How_Does_M onoTouch_Work.3f
    12. 12. Default Assemblies• There are many default assemblies in MonoTouch, many in support of XML, Linq, WCF, SQLite, Sockets and more.• Assemblies can be added by adding DLL’s to the MonoTouch project as references.• http://docs.xamarin.com/iOS/about/assemblies• http://iOSapi.xamarin.com/?link=root%3a%2fcla sslib
    13. 13. There are many Apps in the App Store• There are many Apps from MonoTouch in the App Store, but there is always a concern when relying on a proprietary licensed product like MonoTouch, but I always say that it is better to have something done quickly than not at all.• Sample App Store Apps http://xamarin.com/apps
    14. 14. There are many Samples• https://github.com/xamarin/MonoTouch- samples• http://samples.xamarin.com/iOS• https://bitbucket.org/mrshrinkray/MonoTouc h-samples/src• http://MonoTouchexamples.com/• https://github.com/chrisntr/MonoTouch- Examples
    15. 15. MONODEVELOP IS NOTVISUAL STUDIO
    16. 16. There are many differences• Just because something supports .Net 4, it doesn’t mean it supports Visual Studio 2010 functionality.• It supports C# functionality wrapped around iOS.• For Instance, I can set up a UnitTest directly with Visual Studio tools, while Mono uses Nunit, so just be aware that you may be missing Visual Studio features.
    17. 17. There are many differences• For Instance, I can set up a Test Project for Visual Studio Test,
    18. 18. There are limitations• Besides some of the Visual Studio plugins and extensions, MonoTouch does have C# language limitations, such as limited Generics Support.• See http://docs.xamarin.com/iOS/about/limitatio ns
    19. 19. INSTALLATION
    20. 20. You can play for free• An evaluation version of MonoTouch can be used in the iPad simulator for the MAC OSX, but a license will have to be purchased when running the MonoTouch program on the physical device.• The Trial can be downloaded from http://xamarin.com/trial/
    21. 21. You can play for free• An evaluation version of MonoTouch can be used in the iPad simulator for the MAC OSX, but a license will have to be purchased when running the MonoTouch program on the physical device.• The Trial can be downloaded from http://xamarin.com/trial/
    22. 22. Install…• Ensure Xcode is installed.• Install the Mono Framework• Install MonoDevelop• Install MonoTouch
    23. 23. Ensure that Xcode is installed• Install the correct Xcode for the MAC OSX, get Xcode from https://developer.apple.com/devcenter/iOS/i ndex.action• Check Xcode Installation by using the Terminal and typing “/Developer/usr/bin/xcodebuild –version”
    24. 24. Install Mono• Install mono SDK from http://www.go- mono.com/mono-downloads/download.html• Install the MonoDevelop from http://monodevelop.com/• Install MonoTouchhttp://xamarin.com/trial/
    25. 25. MVC
    26. 26. Model-View-Controller (MVC) The Model-View-Controller is the mostcommon design pattern in SoftwareArchitecture. There is the .NET MVC3, or MVC4,framework that can be used to implement it inMonoTouch for iPad design as well as forASP.NET design.An intro to MonoTouch MVC can be found athttp://www.infoq.com/articles/MonoTouch-mvc
    27. 27. Model-View-Controller (MVC)• Here are the pieces:
    28. 28. UIKit MVC Microsoft’s MVC3 project is a ASP.NETimplementation of MVC. For the iPad MVC, the iOS UIKIT will have tobe used. When working with MonoTouch, a basicknowledge of iOS will have to be established.MonTouch adds C# .Net on top of iOS, it doesnot replace it. Let’s start with a MVC UIKit example.
    29. 29. An MVC Example Microsoft’s MVC3 project is a ASP.NETimplementation of MVC. For the iPad MVC, the iOS UIKIT will have to be usedand it will use it from the Xcode installed on the MACOSX. When working with MonoTouch, a basic knowledge ofiOS will have to be established.MonTouch adds C# .Net on top of iOS, it does notreplace it.http://docs.xamarin.com/iOS/getting_started/intro_to_mvc_in_iOS
    30. 30. AppDelegate One of the classes defined in the UIKit is theAppDelegate which is automatically defined inall MonoTouch projects in Main.cs. Its function is to receive the notificationsfrom the OS that may affect application. I like to the think of of it as the globalhandling of the application.http://escoz.com/blog/MonoTouch-uiapplication-and-appdelegate-explained/
    31. 31. AppDelegate functions Normally, there will be a function namedFinishedLaunching that will have“window.makeKeyAnd” that will display thewindow from MainWindow.xib.
    32. 32. AppDelegate example
    33. 33. Other DelegatesiOS contains other delegates that are used topass information between the application and OS. Examples are UIAccelerometerDelegate,MPMediaPickerControllerDelegate,MKMapViewDelegate, UITableViewDelegate andmore. These Delegates may use Protocols and Eventsfor some of their communication.http://docs.xamarin.com/iOS/tutorials/Events%2c_Protocols_and_Delegates
    34. 34. UIViewUIView is the base class that contain all thescreen elements and properties to be managedby the UIViewController. The UIView has many default subclasses thatcan be used, such asUIControl, UIScrollableView, UITableView andmore.https://developer.apple.com/library/iOS/#documentation/uikit/reference/uiview_class/UIView/UIView.html
    35. 35. Some UIView subclasses
    36. 36. Notice that Interface Builder matches UIKit
    37. 37. UIViewController A default controller that controls the view. It comes with a lifecycle for functions tocheck if the ViewDidload, ViewDidUnload, andmore.https://developer.apple.com/library/iOS/#documentation/UIKit/Reference/UIViewController_Class/Reference/Reference.html
    38. 38. UIViewController->ViewDidLoadViewDidLoad is very important because afterthe View loads, then many of the pieces areadded here to the, like buttons, labels, andmore views.
    39. 39. Starting with Controllers Many controllers will be derived from theUIKitUIViewController for the main UI View. Some examples can be found athttp://www.infoq.com/articles/MonoTouch-mvc andhttp://www.knowing.net/index.php/MonoTouch-custom-viewcontroller-adding-stepwise-subviews/
    40. 40. Starting with Controllers Many controllers will be derived from theUIKitUIViewController for the main UI View. Some examples can be found athttp://www.infoq.com/articles/MonoTouch-mvc andhttp://www.knowing.net/index.php/MonoTouch-custom-viewcontroller-adding-stepwise-subviews/
    41. 41. NIB File The NIB file is the compiled set of XIBfiles, the XML, for the App. It will be packaged in the deployed App.http://developer.apple.com/library/mac/#documentation/Cocoa/Conceptual/LoadingResources/CocoaNibs/CocoaNibs.html
    42. 42. XIB File There are many XML file formats to helpgenerate GUI’s, for example in Microsofts WPF,there is the XAML file format. For iOS, it is the XIB file format.These file formats offer a good base toinitialize the graphics based on the devices gridsystem, but tighter control of the graphics willrely on the MVC code.
    43. 43. XIB Code Generationhttp://docs.xamarin.com/iOS/advanced_topics/xib_code_generation
    44. 44. Interface Builder The XIB file can be managed in Xcode’sInterface Builder.Seehttp://en.wikipedia.org/wiki/Interface_Builder Pro’s and Cons of IB and XIB can be found athttp://mobile.tutsplus.com/tutorials/iphone/interface-builder/
    45. 45. Outlets An outlet connects Interface Builder to thecode. It is is the plumbing for the code behind forthe MonoTouch to Objective-C bridge.http://docs.xamarin.com/iOS/advanced_topics/xib_code_generation#Outlet_Properties
    46. 46. Adding an Outlet An outlet can be added in the Interface Builder(IB) or programmatically. It can be added to the AppDelegate through IB. Programmatically, it can be added through theOutletAttribute: [Outlet] UIButtonButtonTap { get; set; }http://docs.xamarin.com/iOS/getting_started/hello_iphone#Adding_an_Outlet
    47. 47. Actions Actions in Objective-C are equivalent tocontrol events in C#. Actions deliver notification signals to variousobjects.http://docs.xamarin.com/iOS/tutorials/Events,_Protocols_and_Delegates
    48. 48. Adding an Action An action can be added in the Interface Builder(IB) or programmatically. The IB will generate action code that can bedone programmatically with the Actionannotation:[Action ("actnButtonClick:")]partial void actnButtonClick (MonoTouch.Foundation.NSObject sender);http://docs.xamarin.com/iOS/getting_started/hello_iphone#Adding_an_Action
    49. 49. FIRST APP
    50. 50. MonoDevelop->New->Solution
    51. 51. Many pieces are created The AppDelegate.cs, Main.cs, defaultControllers, and default XIBs are created now. The iPad application should compile and runalready.
    52. 52. Many pieces are created
    53. 53. Code was generated The AppDelegate.cs and Main.cs weregenerated to start the application. For the main screen, aMainViewController.xib, MainViewController.cs,and the code behind that links theMainViewController to the XIB, asMainViewController.designer.cs. A similar second screen is created when“info” is pushed as FlipSideViewController.
    54. 54. Run-> Start Debugging(iPad Simulator Launches)
    55. 55. The showInfo Action will call the showInfofunction, calling the FlipsController
    56. 56. We can see showInfo Action andMainController in the XIB view
    57. 57. Double Click ->FlipsideViewController.xib(Xcode Interface Builder Launches)
    58. 58. Add a Label
    59. 59. Run again, now it has a Label
    60. 60. There was a “done” button, notice the Action for done in thecode behind and the function in the Controller
    61. 61. Some notes … We just changed theFlipsideViewController.xib, which may updatethe interface to the FlipSideViewController withthe code behind codeFlipSideViewController.designer.cs.
    62. 62. This also means that the label is in theXIB code and the object is embedded
    63. 63. Let’s add a label programmatically inViewDidLoad
    64. 64. Executing it, we see the new(HomeView) label.
    65. 65. ADDING AVIEW
    66. 66. Add a ViewController to the Project
    67. 67. Which creates a default template for both thecontroller and XIB.
    68. 68. And an empty XIB that works as the View
    69. 69. Xamarim Recipe for Add a New View
    70. 70. Running the Add New View
    71. 71. MONOTOUCH.DIALOG
    72. 72. IntroMonoTouch.dialog is a framework forMonoTouch that can be found athttps://github.com/migueldeicaza/MonoTouch.Dialog The purpose of MonoTouch.Dialog is to savetime in building dialog boxes and showing tablebased information.
    73. 73. Many Demo Apps
    74. 74. Switching it to iPad
    75. 75. Demos in iPad
    76. 76. Xamarin offers a Tutorial
    77. 77. MonoTouch Elements(Extended classes of MonoTouch.Dialog)
    78. 78. MonoTouch Elements Running
    79. 79. Xamarin Elements Tutorial
    80. 80. Xamarin Reflections Tutorial
    81. 81. Running Reflections Tutorial
    82. 82. Reflections Tutorial Notes• Notice that there is no XIB file or Controller class.• There is a decorated class with the attribute values.• A UITableView will be created with section SectionAttributes.
    83. 83. Set the values for the Dialog
    84. 84. Create the Controller Flow for the Dialog in theAppDelegate
    85. 85. WORKINGWITH TABLESAND CELLS
    86. 86. Tables and Cells Intro• UITableView is the most common layout and data display tool in iOS.• A normal display could be simply displaying the rows of tables.• See http://docs.xamarin.com/iOS/tutorials/Worki ng_with_Tables_and_Cells
    87. 87. Xamarin Tutorial
    88. 88. Running the Basic Table
    89. 89. Running the Table Edit Mode
    90. 90. INTRO TOSTORYBOARDS
    91. 91. Storyboards -- Apple• In iOS5, Apple introduced a concept called Storyboards.• A Storyboard is a visual representation of the user interface of an iOS application.• See http://developer.apple.com/library/mac/#do cumentation/General/Conceptual/Devpedia- CocoaApp/Storyboard.html
    92. 92. Storyboards -- MonoTouch• Xamarin offers a Tutorial and sample code for a Storyboard.• See http://docs.xamarin.com/ios/tutorials/Introd uction_to_Storyboards
    93. 93. Storyboards – The sample• The sample will show Controllers, AppDelegate, plist, and Main as normal, but there is a also a storyboard file.
    94. 94. The Storyboard file in Xcode
    95. 95. Storyboards -- segue• The segue manages the transitions between the scenes and passes data with a “sender”.
    96. 96. Storyboards -- dock• The dock is used to define outlets and actions between the view controller and views.
    97. 97. Storyboards -- dock• The iPad can have multiple scenes appear at once, but the scene is similar to a View.
    98. 98. Running the sample shows navigation
    99. 99. COMMANDSAND TOOLS
    100. 100. mono has several command line tools
    101. 101. mtouch Commands
    102. 102. Multiple IDE’s• Multiple MonoDevoleps can be run on Mac OSX with “open -n /Applications/MonoDevelop.app”• See http://microsoft2apple.com/2010/09/26/mul tiple-instances-of-monodevelop-on-a-mac/
    103. 103. MonoTouch Profiler
    104. 104. CONCLUSION

    ×