Video here: http://youtu.be/eeGvMkicAv4
Xamarin.iOS enables us to write native applications that take full advantage of iOS's large number of libraries - from the user interface to motion processing, graphics, audio, cameras, sensors, networking... This incredibly rich software platform runs all day long in the pockets of hundreds of millions of people. When you couple it to .NET, you have a programmer's dream environment.
So let's learn to program iOS! In a little over an hour we will:
• Browse through iOS's APIs to find interesting bits of functionality
• Explore the architecture of UIKit - the user interface framework for iOS
• Use Xamarin Studio to write and debug applications
With this introduction you will have enough knowledge to write your first application that can use all the richness of iOS and all your favorite code written in .NET. Oh, and it will run on beautiful devices too.
11. Cocoa Touch
•
UIKit to create the UI
•
iAd to get rich
•
GameKit to interface with Game Center
•
MapKit for interactive 2D and 3D maps
•
AddressBookUI to access Contacts
•
EventKitUI to access the Calendar
•
MessageUI to send email or messages
12. Media
•
CoreGraphics to render vector graphics onto bitmaps
•
ImageIO even supports raw images
•
CoreImage hardware accelerated image processing
•
CoreAnimation for high performance realtime rendering (basis for UIKit)
•
GLKit for all your 3D needs
•
SpriteKit is a 2D sprite game engine
•
AVFoundation, AssetsLibrary, AudioToolbox, AudioUnit,
CoreAudio, CoreMIDI, CoreVideo, OpenAL, Media Player . Get the
picture?
13. Services
•
Foundation provides a serializable data, collections, networking, data streams,
strings (like the BCL)
•
CoreLocation provides location updates
•
CoreMotion provides orientation and activity tracking
•
Multipeer Connectivity easily create peer-to-peer and mesh networks
•
JavaScriptCore full JavaScript engine that you can embed in your app and
even bridge to your object model
•
CoreData full ORM and data store that even works over iCloud
•
Social accesses OS-level social accounts to post messages
•
PassKit to add passes to the Passbook app
14. Core OS
•
Accelerate super fast and efficient image and
matrix math library
•
Security provides safe places to put data
•
CoreBluetooth gives low level access to the
Bluetooth hardware
•
Exter nalAccessory gives low level access to
devices plugged into the device
29. UIViewController
is an MVC controller
is an MVC controller
Model
VIEW
CONTROLLER
Cloud Data
User Data
Services
Device Sensors
Label
Table
Edit Box
30. UIViewController
•
A Screen of UI
-
on iPhone, takes up the majority of the screen
-
on iPad, can take up the whole screen or have
children view controllers in a layout
-
designed to work with parent UINavigationController
with navigation actions and toolbar actions
-
present or otherwise transitions to other view
controllers
34. UIView
•
“Dumb” - should not interact with the Model directly
•
Responsible for drawing itself
•
Contains subviews to layout
•
Receives touch events, can be assigned
gesture recognizers
•
Participates in the responder chain for user input
(keyboard, pop-up menus)
37. Input Views
UIButton
You know what it does
UISwitch
On/Off toggle
UITextField
Single-line text input
UISegmentedContro
l
Modern radio buttons
UIStepper
Two-button action
UISlider
Discrete or continuous
number selection
38. UIScrollView
•
Scroll and zoom subviews
•
Responsible for velocity scroll
and bounce effects
•
Can also page through views
•
Scroll views within scroll views
are supported
•
Basis for many full screen
views
39. UITableView
•
Scroll view designed to display
a long vertical list of cells
•
Used everywhere in iOS from
login forms, status feeds,
episode lists…
•
MonoTouch.Dialog simplifies
the interface
40. UICollectionView
•
Versatile and efficient view to
display large amount numbers
of views arranged and sized in
any fashion
•
Introduced in iOS 6, these are
meant to replace UITableViews
to create richer UIs
•
Pluggable layout engine with
built-in flow layout
•
Advanced transition and
physical animations built into
iOS 7
41. UIWebView
•
Practically an entire web
browser in a UIView
•
You can control its cookies and
cache
•
You can execute JavaScript
code against the DOM
•
You can feed it raw HTML or
point it to a URL
48. UIGestureRecognizer
•
Easy recognition of single and multitouch events
•
Multiple recognizers can be added to a view
•
Can coordinate with other gesture recognizers
52. UINavigationController
•
Maintains a stack of
UIViewController like a web
browser
•
Provides a navigation bar and
a toolbar for actions
•
Fundamental controller for
iPhone UI
•
UIViewControllers are
designed to work well within a
UINavigationController
53. UITabBarController
•
Up to 5 discrete view
controllers accessible by
buttons at the bottom of the
screen
•
Often these view controllers
are UINavigationControllers
60. Delegate objects
•
Instead of many events that can be subscribed to
by many different objects,
•
Events are overridable methods on an object that
get called as if they were events
•
Can also be used to pass data back to the calling
object
62. Reusable Views
In order to be fast and lean,
views with potentially many subviews
recycle offscreen views
(Virtual list mode in WinForms)
63. Reusable Views
Usually these views have a
DataSource
property that is responsible for creating and data
binding reusable subviews
64. UITableView.DataSource
public override UITableViewCell GetCell (UITableView tableView, NSIndexPath indexPath)
{
var cell = tableView.DequeueReusableCell (EpisodeTableViewCell.ReuseId)
as EpisodeTableViewCell;
if (cell == null) {
cell = new EpisodeTableViewCell ();
}
cell.Episode = Controller.episodes [indexPath.Row];
}
return cell;
When a cell goes offscreen, it is removed from the view hierarchy and
stored in a cache
When the table view needs a new cell to display, your code should take
from this cache