deep dive xamarin.ios

Post on 07-May-2015

806 Views

Category:

Technology

0 Downloads

Preview:

Click to see full reader

DESCRIPTION

My presentation from St. Louis Days of .NET that covers the 20% of concepts that helps you get through the 80% of your iOS app development with Xamarin.IOS.

TRANSCRIPT

A Deeper Dive into Xamarin.IOS

Ben Bishopben@rendr.io

for code/slides...@benjamminstl

@rendrstl

Who Am i?• My name is Ben Bishop (Twitter:

@benjamminstl)

• I grew up in a small rural town of Indiana

• Went to Purdue University

• Now lives in Saint Louis

• Been independent for 4+ years

• Worked at an agency for 5 years, 1 year at TMG

my new companyhttp://rendr.io

David ortinauhttp://xamarin.com/evolve/2013

FLash

Away3D, AIR, AS3, RobotLegs, FlexUnit

Native IOSXamarin.IOS, Facebook, Twitter, SQLite, C#, NUnit

$1200+60 hours

Native AndroidXamarin.Android, C#, Twitter, Facebook, SQLite

HybridPhoneGap, HTML, CSS3, jQuery, Backbone,

RequireJS

Mobile optimized WebjQuery, Backbone, CSS3, Ruby on Rails,

Moustache, JSON

WHAT IS A XAMARIN?

“The best damn mobile team,building the best damn mobile platform.”

What is Mono?• Mono 1.0 was released on June 30, 2004

• “The Mono runtime contains a code execution engine that translates ECMA CIL byte codes into native code and supports a number of processors: ARM, MIPS SPARC, PowerPC, S390 , x86, x86-64 and IA-64 for 64-bit modes.”

• Also has support for LLVM

• Runs on Linux, OSX, Windows, PS3, XBox 360, Wii

How does Mono Work?“Xamarin compiles your app to a native binary, not cross-compiled, and not interpreted.”

Code StructureBy only having to write core code once, more time

can be spent tuning the UI per platform.

cross platform strategies

must have componentsComponents that keep you from having to write

platform specific code.

xamarin.mobileA component that helps abstract your code for

location, photos, and contacts across all platforms.

Xamarin.SocialA component that helps abstract your code for

App.Net, Twitter, Facebook, and Flickr

xamarin.authMakes OAuth suck less.

DataRestSharp, SQLite.NET, and JSON.net help you

store and retrieve data for your app.

Frameworks

https://github.com/MvvmCross/MvvmCross

https://github.com/benbishop/MonkeyArms

interfaces are your friend

iOS Implementation

Have your platform specific views implementthe interface.

android implementation

ios implementation

android implementation

Mediator/View Model

Your Mediator or ViewModel will have a reference to the View

UI Logic

Mock your views

Moq lets you mock your viewsfor Unit Tests.

Unit Test UI Logic

Moq can raise events and verifyMethod invocation.

Test runner

Strings

https://gist.github.com/benbishop/6232751ResourceManager

detect locale

anatomy of an iOS app

info.plist

info.plist

important

Need to specify 640x1136 Launch Image soiOS knows your app supports tall UI

entitlements.plist

New for iOS7

New to iOS7

Main.CS

Entry point for your app

AppDelegate.cs

Creates the UI Window and attachesa ViewController.

ViewController

This is responsible for your screen.

ViewController Lifecycle

Setup/tear down

Great place to do any setup/tear down.

View

Creating a view

UIBUTTON

frame vs bounds

Frame A view's frame (CGRect) is the position of its rectangle in the superview's coordinate system. By default it starts at the top left.Bounds A view's bounds (CGRect) expresses a view rectangle in its own coordinate system.

extend views

class extensions

All UIView classes now have a CenterHorizontally method

Images for multi DPI

Text Input

view event handling

View Controller Types

UIViewController TabViewControllerUITableViewControll

erUINavigationControll

er

UITabViewController

Setting title/Icon

Header buttons

detecting ios7

UITableViews

UITableViews

UITableviewsource

UITableviewsource

UITableviewCell

uitableviewcell styles

UIPickerView

UIPickerView

uipickerview source

UIPICKERVIEWMODEL

UIPickerviewModel

UIPickerviewModel

UIPickerviewmodel

Dialog

http://docs.xamarin.com/guides/ios/user_interface/monotouch.dialog/

Rapid UI dev

JSON support

Attributes

Let’s decorate!!

parting thoughts

experiences• iOS sandbox is limited. You are at Apple’s mercy

• Provisioning is a pain

• iOS SDK is very prescriptive in regards to look and feel

• Most things are genuinely easier in iOS than Android. Music player, sharing to FB/Twitter, selecting photos...

• Few device configurations to work with.

Gracias

top related