SlideShare a Scribd company logo
Creare app native su
iOS, Android, Mac &
Windows in C#
Introduzione a Xamarin.iOS
Gli speaker di oggi
Guido Magrin
Xamarin & Microsoft Student Partner
Xamarin Certified Developer
@GuidoMagrin
Dove trovo le slide?
http://www.slideshare.net/guidomagrin
Gli Xamarin Student Partner
https://www.facebook.com/XSAMilano
Oggi parleremo di…
Xamarin.iOS
Chi ha già
sentito parlare di
Xamarin.iOS?
Xamarin + Xamarin.Forms
Approccio offerto da Xamarin.Forms:
Codice UI condiviso, controlli nativi
Approccio tradizionale di Xamarin
Shared UI Code
.NET + iOS APIs | copertura al 100%
Qualsiasi cosa si possa fare in Objective-C
o Swift può essere fatta in C#
con Xamarin in Visual Studio
Xamarin è sempre aggiornato
Release iOS supportate al day-one:
iOS 5, iOS 6, iOS 7, iOS 7.1, iOS 8, iOS 9, iOS 10
Supporto ad Apple Watch!
Xamarin Studio
PC o Mac
Plugin Visual Studio
VS 2010 e superiore
Ambienti di Sviluppo
Integrazione in Visual Studio
Una soluzione sola per:
• iOS
• Android
• Windows Phone
• Windows Store
Tutti i plugin e le funzioni
di Visual Studio:
• ReSharper
• Team Foundation Server
Integrazione in Visual Studio
Debugging su:
• Emulatori
• Dispositivi
Integrati nella toolbar:
• Stato
• Logs
• Lista di dispositivi
Xamarin Studio
• Ottimizzato per lo sviluppo
cross-platform
• Accedi alle API native con
l’autocompletamento
• Designer per Android e iOS
• Debugging avanzato su
emulatore o dispositivo
Designer per Xamarin iOS
• Il primo designer iOS
presente in Xamarin Studio e
Visual Studio
• Simile al designer
tradizionale di Visual Studio
• Supporta pienamente l’UIKit
• Modifica i componenti
personalizzati e di terze parti
• Modifiche grafiche applicate
in tempo reale
Cosa impareremo oggi?
• Fundamentals
• The package
• Views and navigation
• Managing lists
• Working files
Fundamentals
Before we start...
• You need a Mac:
– OS X 10.9.4+
– Xcode
– Xamarin.iOS
• You can still work on your Windows PC:
– Visual Studio
– Xamarin.iOS
Before we start...
• The OS X and Windows machines have to be connected
to the same network
• You can connect a OS X machine only to multiple
Windows machines
• OS X and Windows need to have the same Xamarin.iOS
version installed
iPhone simulator
• Requires the latest version of Xamarin.iOS.
• Allows you to “completely forget” about your
Mac.
• Fun fact: given that the Windows PC has a
touchscreen, it supports this kind of input.
What if I don’t have a Mac? Rent one!
• Always available.
• Pay as you go.
• Scalable according to our needs.
The application
• Main
– It’s the entry point of the app
– It creates the application
• AppDelegate
– It manages the system events
– It has an Application Window with the UI
– It starts the Main interface
The startup
• Storyboard
– Takes care of initializing the main controller
– The controller manages the main view and the sub views
• ViewController
– It receives the interactions
from the views
– It takes care of displaying
the data on the view
Apple Watch has Storyboards, too!
• Same functionalities you would expect from iPhone storyboards.
• As of today, easier to work with in terms of app rescaling.
Model-View-Controller (MVC)
• iOS is based on MVC
– The Model describes the data
– The View describes the UI
– The Controller manages the interactions
between the Model and the View
La prima app
Xamarin.Forms
Domanda 1
Posso creare applicazioni iOS usando esclusivamente un PC Windows
a) Vero
b) Falso
Domanda 1
Posso creare applicazioni iOS usando esclusivamente un PC Windows
a) Vero
b) Falso
Domanda 2
Da quali componenti è composta un’applicazione iOS?
a) Main, AppDelegate
b) Window, AppDelegate
c) Main, ViewController
d) Screen, ViewController
Domanda 2
Da quali componenti è composta un’applicazione iOS?
a) Main, AppDelegate
b) Window, AppDelegate
c) Main, ViewController
d) Screen, ViewController
The package
Resources
• iOS requires that all the resources are placed in the root
folder
• Xamarin adds a Resource folder
– At compile time, the content is copied in the root
• The Build Action has to be set to BundleResource
Images
• The original iPhone had a resolution of 320x480
• New resolutions have been added
• Naming conventions to manage the assets:
– @2x -> Retina
– @3x-> iPhone 6 Plus
– ~iphone -> Used on the iPhone
– ~ipad -> Used on the iPad
– Example: Image.png, Image@2x.png,
Image2x~iphone.png
Info.plist and Entitlements.plist
iPhone Deployment info
• It contains the main info about the app
configuration:
– Main interface
– Supported orientations
– Status bar style
Entitlements
• Used to configure iCloud,
push notifications, HealthKit, etc.
Views and
navigation
La prima app
Xamarin.Forms
Domanda 1
Se volessi implementare iCloud nella mia app iOS, tramite quale file
dovrei abilitarne l’integrazione?
a) BundleResources.plist
b) Info.plist
c) CloudConnectivity.plist
d) Entitlements.plist
Domanda 1
Se volessi implementare iCloud nella mia app iOS, tramite quale file
dovrei abilitarne l’integrazione?
a) BundleResources.plist
b) Info.plist
c) CloudConnectivity.plist
d) Entitlements.plist
Storyboards
• In the past, iOS developers managed views using the
XIB files
• Each XIB files was mapped with a controller
• The developer needed to manually manage the
navigation between two views
Storyboards
• A storyboard is the visual representation of all the
screens in an app
• It’s made by different scenes
• A scene is a View managed by a ViewController
• Scenes contains objects and controls that are used to
manage interactions and to display data
The Xamarin designer
• Storyboards can’t be created in code
• The underline XML is generated automatically by
the designer
• Xamarin offers a built-in designer, which requires
a Mac Build Host connected to the Windows
machine
Navigation
• Navigation in Storyboards is managed using
Segues
• A Segue is a transition between two scenes
• Multiple transitions:
– Simple navigation
– Modal views
– Popover
• Segues are created using the designer
Storyboards, Segues and Xamarin designer
Storyboards and
segues
DEMO
La prima app
Xamarin.Forms
Domanda 1
Come si chiama il file contenente tutte le schermate della mia app iOS?
a) Segues
b) Storyboard
c) Designer
d) BuildHost
Domanda 1
Come si chiama il file contenente tutte le schermate della mia app iOS?
a) Segues
b) Storyboard
c) Designer
d) BuildHost
Domanda 2
Cosa uso per navigare tra le varie pagine della mia app iOS?
a) Navigator
b) Arrow
c) Transitioner
d) Segues
Domanda 2
Cosa uso per navigare tra le varie pagine della mia app iOS?
a) Navigator
b) Arrow
c) Transitioner
d) Segues
Passing data
• A storyboards offers a method called
PrepareForSegue() to override
• You get a reference to the destination control and
you pass the data into a property
public override void PrepareForSegue(UIStoryboardSegue segue, NSObject sender)
{
base.PrepareForSegue(segue, sender);
var controller = segue.DestinationViewController as MyPageController;
controller.TextToShow = MyPhoneNumber.Text;
}
Conditional navigation
• Sometimes you need to perform navigation only if a
specific condition is satisfied
• You can override the ShouldPerformSegue()
method
public override bool ShouldPerformSegue(string segueIdentifier, NSObject sender)
{
if (segueIdentifier == "SegueToMainPage")
{
if (PasswordTextField.Text == "password") return true;
else return false;
}
return base.ShouldPerformSegue(segueIdentifier, sender);
}
Advanced segues
DEMO
The view’s lifecycle
Methods intherited by the UIViewController class
• ViewDidLoad
– The controller has loaded the connected view
• ViewWillAppear
– The pagecontent is about to appear
• ViewWillDisappear
– The page content is about to disappear
• ViewDidAppear / ViewDidDisappear
– The page content is appeared / disappeared
Alerts
If you target a pre iOS 8 device, you need to use the
UIAlertView class
UIAlertView av = new UIAlertView("Title",
"message",
null,
"OK",
null);
av.Show();
Alerts
If you target an iOS 8+ device, you can use:
• UIAlertController to display an alert
• UIActionSheet to display an action sheet
Alerts
DEMO
Built-in applications
• Same URI-based approach that you find in Windows
Phone
• You use the OpenUrl() method to invoke a URL
NSUrl url = new NSUrl("http://www.xamarin.com");
if (UIApplication.SharedApplication.CanOpenUrl(url))
{
UIApplication.SharedApplication.OpenUrl(url);
}
Managing lists
Table Views
Many different classes and APIs to implement a list
• UITableView
– It’s the table that contains the rows to display
• UITableViewCell
– It represent a row of the list
• UITableViewSource
– It’s a specific Xamarin class that makes easier to implement a
UITableView
– On iOS, you would to implement separately the
UIViewTableDataSource and UITableViewDelegate classes
Table Views
Many different classes and APIs to implement a list
• NSIndexPath
– It identifies a specific element of the table
• UITableViewController
– It’s the controller that implements an UITableView
Table layout
• Four different built-in styles
• To implement a custom layout, you need to implement a
custom cell
Creating a UITableViewSource
• You need to choose a cell identifier
• You need to implement the GetCell() method to define the
layout of a cell
public class TableSource : UITableViewSource
{
string[] tableItems;
string cellIdentifier = "TableCell";
public TableSource(string[] items)
{
tableItems = items;
}
public override nint RowsInSection(UITableView tableview, nint section) { }
public override UITableViewCell GetCell(UITableView tableView, Foundation.NSIndexPath
indexPath)
{
...
}
}
Cell reuse
• It’s the technique used to improve performances in case
of big collections to display
• You first ask for a cell to reuse before creating a new one
public override UITableViewCell GetCell(UITableView tableView, Foundation.NSIndexPath
indexPath)
{
UITableViewCell cell = tableView.DequeueReusableCell(cellIdentifier);
// if there are no cells to reuse, create a new one
if (cell == null)
cell = new UITableViewCell(UITableViewCellStyle.Default, cellIdentifier);
cell.TextLabel.Text = tableItems[indexPath.Row];
return cell;
}
Cell reuse
Starting from iO6, there’s a new method that automatically
takes care of generating the proper cell for you
public override UITableViewCell GetCell(UITableView tableView, NSIndexPath
indexPath)
{
var cell = (MyCell)tableView.DequeueReusableCell(MyCellId, indexPath);
return cell;
}
Additional supported features
Managing
lists
DEMO
La prima app
Xamarin.Forms
Domanda 1
Di quali metodi e controlli mi posso avvalere per creare una lista in
un’app iOS?
a) UITableView
b) UITableViewContainer
c) UITableViewSource
d) UITableViewCell
Domanda 1
Di quali metodi e controlli mi posso avvalere per creare una lista in
un’app iOS?
a) UITableView
b) UITableViewContainer
c) UITableViewSource
d) UITableViewCell
Domanda 2
Per implementare un Custom Layout, devo implementare una Custom
Cell
a) Vero
b) Falso
Domanda 2
Per implementare un Custom Layout, devo implementare una Custom
Cell
a) Vero
b) Falso
Domanda 3
Quante tipologie di Layout di default sono presenti?
a) Due
b) Quattro
c) Otto
d) Dodici
Domanda 3
Quante tipologie di Layout di default sono presenti?
a) Due
b) Quattro
c) Otto
d) Dodici
Using a custom layout
• You need to create a custom cell
• You can do it in code or with the designer
• You add the controls inside
the UIViewTableCell object
• In code, you assign a value to the controls
Using a custom layout
In the UITableViewSource, you use the custom cell class
instead of the base UITableViewCell one in the GetCell()
method
public override UITableViewCell GetCell(UITableView tableView, NSIndexPath indexPath)
{
CharacterCellView cell = tableView.DequeueReusableCell(CellIdentifier, indexPath) as
CharacterCellView;
Character currentCharacter = tableItems[indexPath.Row];
cell.UpdateCharacter(currentCharacter);
return cell;
}
Custom cells
DEMO
Working with files
Files and folders
• To create files and folder you can leverage the basic .NET
APIs (System.IO)
• Documents is the base path where all the files of the
application are stored
• In the info.plist you can
set the option
UIFileSharingEnabled
to true to allow access
to local files through
iTunes
The folders
• Library
– To store the internal files of the application
– It’s automatically backed up
• Library/Preferences
– To store the application settings
– It’s automatically backed up
• Library/Caches
– iOS can delete the content in case the space is going low
– It’s not backed up
Working with
files and folders
DEMO
Grazie per l’attenzione 
Guido Magrin
Xamarin Student Partner
@GuidoMagrin

More Related Content

What's hot

Learning C# iPad Programming
Learning C# iPad ProgrammingLearning C# iPad Programming
Learning C# iPad Programming
Rich Helton
 
Native Script Overview
Native Script OverviewNative Script Overview
Native Script Overview
Baskar rao Dsn
 
Xamarin Forms
Xamarin FormsXamarin Forms
Xamarin Forms
Fabio Cozzolino
 
Appcelerator Titanium Intro
Appcelerator Titanium IntroAppcelerator Titanium Intro
Appcelerator Titanium Intro
Nicholas Jansma
 
Ionic framework one day training
Ionic framework one day trainingIonic framework one day training
Ionic framework one day training
Troy Miles
 
Rick Blalock: Your Apps are Leaking - Controlling Memory Leaks
Rick Blalock: Your Apps are Leaking - Controlling Memory LeaksRick Blalock: Your Apps are Leaking - Controlling Memory Leaks
Rick Blalock: Your Apps are Leaking - Controlling Memory Leaks
Axway Appcelerator
 
20150728 100분만에 배우는 windows 10 앱 개발
20150728 100분만에 배우는 windows 10 앱 개발20150728 100분만에 배우는 windows 10 앱 개발
20150728 100분만에 배우는 windows 10 앱 개발
영욱 김
 
Native script overview
Native script overviewNative script overview
Native script overview
Baskar rao Dsn
 
Native Mobile Apps, Xamarin, and PhoneGap
Native Mobile Apps, Xamarin, and PhoneGapNative Mobile Apps, Xamarin, and PhoneGap
Native Mobile Apps, Xamarin, and PhoneGap
Sasha Goldshtein
 
Mobile Applications with Angular 4 and Ionic 3
Mobile Applications with Angular 4 and Ionic 3Mobile Applications with Angular 4 and Ionic 3
Mobile Applications with Angular 4 and Ionic 3
Oleksandr Tryshchenko
 
Titanium - Making the most of your single thread
Titanium - Making the most of your single threadTitanium - Making the most of your single thread
Titanium - Making the most of your single thread
Ronald Treur
 
MVVM frameworks - MvvmCross
MVVM frameworks - MvvmCrossMVVM frameworks - MvvmCross
MVVM frameworks - MvvmCross
Flavius-Radu Demian
 
Cross Platform Mobile Apps with the Ionic Framework
Cross Platform Mobile Apps with the Ionic FrameworkCross Platform Mobile Apps with the Ionic Framework
Cross Platform Mobile Apps with the Ionic Framework
Troy Miles
 
Workshop Ionic Framework - CC FE & UX
Workshop Ionic Framework - CC FE & UXWorkshop Ionic Framework - CC FE & UX
Workshop Ionic Framework - CC FE & UX
JWORKS powered by Ordina
 
Building an Ionic hybrid mobile app with TypeScript
Building an Ionic hybrid mobile app with TypeScript Building an Ionic hybrid mobile app with TypeScript
Building an Ionic hybrid mobile app with TypeScript
Serge van den Oever
 
Creating mobile apps - an introduction to Ionic (Engage 2016)
Creating mobile apps - an introduction to Ionic (Engage 2016)Creating mobile apps - an introduction to Ionic (Engage 2016)
Creating mobile apps - an introduction to Ionic (Engage 2016)
Mark Leusink
 
Building Cross Platform Mobile Apps
Building Cross Platform Mobile AppsBuilding Cross Platform Mobile Apps
Building Cross Platform Mobile Apps
Shailendra Chauhan
 
Your choices for building a mobile app in 2016
Your choices for building a mobile app in 2016Your choices for building a mobile app in 2016
Your choices for building a mobile app in 2016
Jad Salhani
 
Hybrid Apps with Ionic Framework
Hybrid Apps with Ionic FrameworkHybrid Apps with Ionic Framework
Hybrid Apps with Ionic Framework
Bramus Van Damme
 
Hybrid app development with ionic
Hybrid app development with ionicHybrid app development with ionic
Hybrid app development with ionic
Wan Muzaffar Wan Hashim
 

What's hot (20)

Learning C# iPad Programming
Learning C# iPad ProgrammingLearning C# iPad Programming
Learning C# iPad Programming
 
Native Script Overview
Native Script OverviewNative Script Overview
Native Script Overview
 
Xamarin Forms
Xamarin FormsXamarin Forms
Xamarin Forms
 
Appcelerator Titanium Intro
Appcelerator Titanium IntroAppcelerator Titanium Intro
Appcelerator Titanium Intro
 
Ionic framework one day training
Ionic framework one day trainingIonic framework one day training
Ionic framework one day training
 
Rick Blalock: Your Apps are Leaking - Controlling Memory Leaks
Rick Blalock: Your Apps are Leaking - Controlling Memory LeaksRick Blalock: Your Apps are Leaking - Controlling Memory Leaks
Rick Blalock: Your Apps are Leaking - Controlling Memory Leaks
 
20150728 100분만에 배우는 windows 10 앱 개발
20150728 100분만에 배우는 windows 10 앱 개발20150728 100분만에 배우는 windows 10 앱 개발
20150728 100분만에 배우는 windows 10 앱 개발
 
Native script overview
Native script overviewNative script overview
Native script overview
 
Native Mobile Apps, Xamarin, and PhoneGap
Native Mobile Apps, Xamarin, and PhoneGapNative Mobile Apps, Xamarin, and PhoneGap
Native Mobile Apps, Xamarin, and PhoneGap
 
Mobile Applications with Angular 4 and Ionic 3
Mobile Applications with Angular 4 and Ionic 3Mobile Applications with Angular 4 and Ionic 3
Mobile Applications with Angular 4 and Ionic 3
 
Titanium - Making the most of your single thread
Titanium - Making the most of your single threadTitanium - Making the most of your single thread
Titanium - Making the most of your single thread
 
MVVM frameworks - MvvmCross
MVVM frameworks - MvvmCrossMVVM frameworks - MvvmCross
MVVM frameworks - MvvmCross
 
Cross Platform Mobile Apps with the Ionic Framework
Cross Platform Mobile Apps with the Ionic FrameworkCross Platform Mobile Apps with the Ionic Framework
Cross Platform Mobile Apps with the Ionic Framework
 
Workshop Ionic Framework - CC FE & UX
Workshop Ionic Framework - CC FE & UXWorkshop Ionic Framework - CC FE & UX
Workshop Ionic Framework - CC FE & UX
 
Building an Ionic hybrid mobile app with TypeScript
Building an Ionic hybrid mobile app with TypeScript Building an Ionic hybrid mobile app with TypeScript
Building an Ionic hybrid mobile app with TypeScript
 
Creating mobile apps - an introduction to Ionic (Engage 2016)
Creating mobile apps - an introduction to Ionic (Engage 2016)Creating mobile apps - an introduction to Ionic (Engage 2016)
Creating mobile apps - an introduction to Ionic (Engage 2016)
 
Building Cross Platform Mobile Apps
Building Cross Platform Mobile AppsBuilding Cross Platform Mobile Apps
Building Cross Platform Mobile Apps
 
Your choices for building a mobile app in 2016
Your choices for building a mobile app in 2016Your choices for building a mobile app in 2016
Your choices for building a mobile app in 2016
 
Hybrid Apps with Ionic Framework
Hybrid Apps with Ionic FrameworkHybrid Apps with Ionic Framework
Hybrid Apps with Ionic Framework
 
Hybrid app development with ionic
Hybrid app development with ionicHybrid app development with ionic
Hybrid app development with ionic
 

Similar to Xamarin.iOS introduction

Xamarin.Mac Introduction
Xamarin.Mac IntroductionXamarin.Mac Introduction
Xamarin.Mac Introduction
Miguel de Icaza
 
Building your first iOS app using Xamarin
Building your first iOS app using XamarinBuilding your first iOS app using Xamarin
Building your first iOS app using Xamarin
Gill Cleeren
 
Introduction to Cross Platform Development with Xamarin/ Visual Studio
Introduction to Cross Platform Development with Xamarin/ Visual StudioIntroduction to Cross Platform Development with Xamarin/ Visual Studio
Introduction to Cross Platform Development with Xamarin/ Visual Studio
IndyMobileNetDev
 
Xamarin Platform
Xamarin PlatformXamarin Platform
Xamarin Platform
Rui Marinho
 
08 mobile development
08   mobile development08   mobile development
08 mobile development
darwinodb
 
Xamarin.Android Introduction
Xamarin.Android IntroductionXamarin.Android Introduction
Xamarin.Android Introduction
Guido Magrin
 
Android Application Development Using Java
Android Application Development Using JavaAndroid Application Development Using Java
Android Application Development Using Java
amaankhan
 
Building your first android app using Xamarin
Building your first android app using XamarinBuilding your first android app using Xamarin
Building your first android app using Xamarin
Gill Cleeren
 
iOS Development Survival Guide for the .NET Guy
iOS Development Survival Guide for the .NET GuyiOS Development Survival Guide for the .NET Guy
iOS Development Survival Guide for the .NET Guy
Nick Landry
 
WP7, Droid, iPhone, Oh my!
WP7, Droid, iPhone, Oh my!WP7, Droid, iPhone, Oh my!
WP7, Droid, iPhone, Oh my!
Chris Hardy
 
Xamarin Technical Assessment Against Native for Cross Platform Mobile Develop...
Xamarin Technical Assessment Against Native for Cross Platform Mobile Develop...Xamarin Technical Assessment Against Native for Cross Platform Mobile Develop...
Xamarin Technical Assessment Against Native for Cross Platform Mobile Develop...
YASH Technologies
 
C# no bolso - desenvolvendo apps multiplataforma
C# no bolso - desenvolvendo apps multiplataformaC# no bolso - desenvolvendo apps multiplataforma
C# no bolso - desenvolvendo apps multiplataforma
Allan Cleysson
 
Introduction to Xamarin
Introduction to XamarinIntroduction to Xamarin
Introduction to Xamarin
Brian Anderson
 
Appium Overview - by Daniel Puterman
Appium Overview - by Daniel PutermanAppium Overview - by Daniel Puterman
Appium Overview - by Daniel Puterman
Applitools
 
EastBay.net Building Mobile Apps with Xamarin and Visual Studio
EastBay.net Building Mobile Apps with Xamarin and Visual StudioEastBay.net Building Mobile Apps with Xamarin and Visual Studio
EastBay.net Building Mobile Apps with Xamarin and Visual Studio
Craig Dunn
 
Building your first android app using xamarin (Gill Cleeren)
Building your first android app using xamarin (Gill Cleeren)Building your first android app using xamarin (Gill Cleeren)
Building your first android app using xamarin (Gill Cleeren)
Visug
 
Windows 8 DevUnleashed - Session 1
Windows 8 DevUnleashed - Session 1Windows 8 DevUnleashed - Session 1
Windows 8 DevUnleashed - Session 1
drudolph11
 
Introduction to Xamarin
Introduction to XamarinIntroduction to Xamarin
Introduction to Xamarin
Vinicius Quaiato
 
Introduction to Xamarin
Introduction to XamarinIntroduction to Xamarin
Introduction to Xamarin
Guy Barrette
 
Xamarin Open House talk - Sela Group - Ofir Makmal
Xamarin Open House talk - Sela Group - Ofir MakmalXamarin Open House talk - Sela Group - Ofir Makmal
Xamarin Open House talk - Sela Group - Ofir Makmal
Ofir Makmal
 

Similar to Xamarin.iOS introduction (20)

Xamarin.Mac Introduction
Xamarin.Mac IntroductionXamarin.Mac Introduction
Xamarin.Mac Introduction
 
Building your first iOS app using Xamarin
Building your first iOS app using XamarinBuilding your first iOS app using Xamarin
Building your first iOS app using Xamarin
 
Introduction to Cross Platform Development with Xamarin/ Visual Studio
Introduction to Cross Platform Development with Xamarin/ Visual StudioIntroduction to Cross Platform Development with Xamarin/ Visual Studio
Introduction to Cross Platform Development with Xamarin/ Visual Studio
 
Xamarin Platform
Xamarin PlatformXamarin Platform
Xamarin Platform
 
08 mobile development
08   mobile development08   mobile development
08 mobile development
 
Xamarin.Android Introduction
Xamarin.Android IntroductionXamarin.Android Introduction
Xamarin.Android Introduction
 
Android Application Development Using Java
Android Application Development Using JavaAndroid Application Development Using Java
Android Application Development Using Java
 
Building your first android app using Xamarin
Building your first android app using XamarinBuilding your first android app using Xamarin
Building your first android app using Xamarin
 
iOS Development Survival Guide for the .NET Guy
iOS Development Survival Guide for the .NET GuyiOS Development Survival Guide for the .NET Guy
iOS Development Survival Guide for the .NET Guy
 
WP7, Droid, iPhone, Oh my!
WP7, Droid, iPhone, Oh my!WP7, Droid, iPhone, Oh my!
WP7, Droid, iPhone, Oh my!
 
Xamarin Technical Assessment Against Native for Cross Platform Mobile Develop...
Xamarin Technical Assessment Against Native for Cross Platform Mobile Develop...Xamarin Technical Assessment Against Native for Cross Platform Mobile Develop...
Xamarin Technical Assessment Against Native for Cross Platform Mobile Develop...
 
C# no bolso - desenvolvendo apps multiplataforma
C# no bolso - desenvolvendo apps multiplataformaC# no bolso - desenvolvendo apps multiplataforma
C# no bolso - desenvolvendo apps multiplataforma
 
Introduction to Xamarin
Introduction to XamarinIntroduction to Xamarin
Introduction to Xamarin
 
Appium Overview - by Daniel Puterman
Appium Overview - by Daniel PutermanAppium Overview - by Daniel Puterman
Appium Overview - by Daniel Puterman
 
EastBay.net Building Mobile Apps with Xamarin and Visual Studio
EastBay.net Building Mobile Apps with Xamarin and Visual StudioEastBay.net Building Mobile Apps with Xamarin and Visual Studio
EastBay.net Building Mobile Apps with Xamarin and Visual Studio
 
Building your first android app using xamarin (Gill Cleeren)
Building your first android app using xamarin (Gill Cleeren)Building your first android app using xamarin (Gill Cleeren)
Building your first android app using xamarin (Gill Cleeren)
 
Windows 8 DevUnleashed - Session 1
Windows 8 DevUnleashed - Session 1Windows 8 DevUnleashed - Session 1
Windows 8 DevUnleashed - Session 1
 
Introduction to Xamarin
Introduction to XamarinIntroduction to Xamarin
Introduction to Xamarin
 
Introduction to Xamarin
Introduction to XamarinIntroduction to Xamarin
Introduction to Xamarin
 
Xamarin Open House talk - Sela Group - Ofir Makmal
Xamarin Open House talk - Sela Group - Ofir MakmalXamarin Open House talk - Sela Group - Ofir Makmal
Xamarin Open House talk - Sela Group - Ofir Makmal
 

More from Guido Magrin

Introduction to C#
Introduction to C#Introduction to C#
Introduction to C#
Guido Magrin
 
SQLite in Xamarin.Forms
SQLite in Xamarin.FormsSQLite in Xamarin.Forms
SQLite in Xamarin.Forms
Guido Magrin
 
LGL Team - UniShare & UniBuy
LGL Team -  UniShare & UniBuyLGL Team -  UniShare & UniBuy
LGL Team - UniShare & UniBuy
Guido Magrin
 
Evius Presentation
Evius PresentationEvius Presentation
Evius Presentation
Guido Magrin
 
Enel Smart Info presentation
Enel Smart Info presentationEnel Smart Info presentation
Enel Smart Info presentation
Guido Magrin
 
Xamarin.Forms Introduction
Xamarin.Forms IntroductionXamarin.Forms Introduction
Xamarin.Forms Introduction
Guido Magrin
 
Microsoft Azure Websites
Microsoft Azure WebsitesMicrosoft Azure Websites
Microsoft Azure Websites
Guido Magrin
 
Introduction to Xamarin
Introduction to XamarinIntroduction to Xamarin
Introduction to Xamarin
Guido Magrin
 

More from Guido Magrin (8)

Introduction to C#
Introduction to C#Introduction to C#
Introduction to C#
 
SQLite in Xamarin.Forms
SQLite in Xamarin.FormsSQLite in Xamarin.Forms
SQLite in Xamarin.Forms
 
LGL Team - UniShare & UniBuy
LGL Team -  UniShare & UniBuyLGL Team -  UniShare & UniBuy
LGL Team - UniShare & UniBuy
 
Evius Presentation
Evius PresentationEvius Presentation
Evius Presentation
 
Enel Smart Info presentation
Enel Smart Info presentationEnel Smart Info presentation
Enel Smart Info presentation
 
Xamarin.Forms Introduction
Xamarin.Forms IntroductionXamarin.Forms Introduction
Xamarin.Forms Introduction
 
Microsoft Azure Websites
Microsoft Azure WebsitesMicrosoft Azure Websites
Microsoft Azure Websites
 
Introduction to Xamarin
Introduction to XamarinIntroduction to Xamarin
Introduction to Xamarin
 

Recently uploaded

All you need to know about Spring Boot and GraalVM
All you need to know about Spring Boot and GraalVMAll you need to know about Spring Boot and GraalVM
All you need to know about Spring Boot and GraalVM
Alina Yurenko
 
Unveiling the Advantages of Agile Software Development.pdf
Unveiling the Advantages of Agile Software Development.pdfUnveiling the Advantages of Agile Software Development.pdf
Unveiling the Advantages of Agile Software Development.pdf
brainerhub1
 
Lecture 2 - software testing SE 412.pptx
Lecture 2 - software testing SE 412.pptxLecture 2 - software testing SE 412.pptx
Lecture 2 - software testing SE 412.pptx
TaghreedAltamimi
 
一比一原版(UMN毕业证)明尼苏达大学毕业证如何办理
一比一原版(UMN毕业证)明尼苏达大学毕业证如何办理一比一原版(UMN毕业证)明尼苏达大学毕业证如何办理
一比一原版(UMN毕业证)明尼苏达大学毕业证如何办理
dakas1
 
Energy consumption of Database Management - Florina Jonuzi
Energy consumption of Database Management - Florina JonuziEnergy consumption of Database Management - Florina Jonuzi
Energy consumption of Database Management - Florina Jonuzi
Green Software Development
 
Mobile App Development Company In Noida | Drona Infotech
Mobile App Development Company In Noida | Drona InfotechMobile App Development Company In Noida | Drona Infotech
Mobile App Development Company In Noida | Drona Infotech
Drona Infotech
 
J-Spring 2024 - Going serverless with Quarkus, GraalVM native images and AWS ...
J-Spring 2024 - Going serverless with Quarkus, GraalVM native images and AWS ...J-Spring 2024 - Going serverless with Quarkus, GraalVM native images and AWS ...
J-Spring 2024 - Going serverless with Quarkus, GraalVM native images and AWS ...
Bert Jan Schrijver
 
Using Query Store in Azure PostgreSQL to Understand Query Performance
Using Query Store in Azure PostgreSQL to Understand Query PerformanceUsing Query Store in Azure PostgreSQL to Understand Query Performance
Using Query Store in Azure PostgreSQL to Understand Query Performance
Grant Fritchey
 
GreenCode-A-VSCode-Plugin--Dario-Jurisic
GreenCode-A-VSCode-Plugin--Dario-JurisicGreenCode-A-VSCode-Plugin--Dario-Jurisic
GreenCode-A-VSCode-Plugin--Dario-Jurisic
Green Software Development
 
Webinar On-Demand: Using Flutter for Embedded
Webinar On-Demand: Using Flutter for EmbeddedWebinar On-Demand: Using Flutter for Embedded
Webinar On-Demand: Using Flutter for Embedded
ICS
 
WWDC 2024 Keynote Review: For CocoaCoders Austin
WWDC 2024 Keynote Review: For CocoaCoders AustinWWDC 2024 Keynote Review: For CocoaCoders Austin
WWDC 2024 Keynote Review: For CocoaCoders Austin
Patrick Weigel
 
UI5con 2024 - Keynote: Latest News about UI5 and it’s Ecosystem
UI5con 2024 - Keynote: Latest News about UI5 and it’s EcosystemUI5con 2024 - Keynote: Latest News about UI5 and it’s Ecosystem
UI5con 2024 - Keynote: Latest News about UI5 and it’s Ecosystem
Peter Muessig
 
如何办理(hull学位证书)英国赫尔大学毕业证硕士文凭原版一模一样
如何办理(hull学位证书)英国赫尔大学毕业证硕士文凭原版一模一样如何办理(hull学位证书)英国赫尔大学毕业证硕士文凭原版一模一样
如何办理(hull学位证书)英国赫尔大学毕业证硕士文凭原版一模一样
gapen1
 
How to write a program in any programming language
How to write a program in any programming languageHow to write a program in any programming language
How to write a program in any programming language
Rakesh Kumar R
 
Microservice Teams - How the cloud changes the way we work
Microservice Teams - How the cloud changes the way we workMicroservice Teams - How the cloud changes the way we work
Microservice Teams - How the cloud changes the way we work
Sven Peters
 
Everything You Need to Know About X-Sign: The eSign Functionality of XfilesPr...
Everything You Need to Know About X-Sign: The eSign Functionality of XfilesPr...Everything You Need to Know About X-Sign: The eSign Functionality of XfilesPr...
Everything You Need to Know About X-Sign: The eSign Functionality of XfilesPr...
XfilesPro
 
在线购买加拿大英属哥伦比亚大学毕业证本科学位证书原版一模一样
在线购买加拿大英属哥伦比亚大学毕业证本科学位证书原版一模一样在线购买加拿大英属哥伦比亚大学毕业证本科学位证书原版一模一样
在线购买加拿大英属哥伦比亚大学毕业证本科学位证书原版一模一样
mz5nrf0n
 
How Can Hiring A Mobile App Development Company Help Your Business Grow?
How Can Hiring A Mobile App Development Company Help Your Business Grow?How Can Hiring A Mobile App Development Company Help Your Business Grow?
How Can Hiring A Mobile App Development Company Help Your Business Grow?
ToXSL Technologies
 
14 th Edition of International conference on computer vision
14 th Edition of International conference on computer vision14 th Edition of International conference on computer vision
14 th Edition of International conference on computer vision
ShulagnaSarkar2
 
Malibou Pitch Deck For Its €3M Seed Round
Malibou Pitch Deck For Its €3M Seed RoundMalibou Pitch Deck For Its €3M Seed Round
Malibou Pitch Deck For Its €3M Seed Round
sjcobrien
 

Recently uploaded (20)

All you need to know about Spring Boot and GraalVM
All you need to know about Spring Boot and GraalVMAll you need to know about Spring Boot and GraalVM
All you need to know about Spring Boot and GraalVM
 
Unveiling the Advantages of Agile Software Development.pdf
Unveiling the Advantages of Agile Software Development.pdfUnveiling the Advantages of Agile Software Development.pdf
Unveiling the Advantages of Agile Software Development.pdf
 
Lecture 2 - software testing SE 412.pptx
Lecture 2 - software testing SE 412.pptxLecture 2 - software testing SE 412.pptx
Lecture 2 - software testing SE 412.pptx
 
一比一原版(UMN毕业证)明尼苏达大学毕业证如何办理
一比一原版(UMN毕业证)明尼苏达大学毕业证如何办理一比一原版(UMN毕业证)明尼苏达大学毕业证如何办理
一比一原版(UMN毕业证)明尼苏达大学毕业证如何办理
 
Energy consumption of Database Management - Florina Jonuzi
Energy consumption of Database Management - Florina JonuziEnergy consumption of Database Management - Florina Jonuzi
Energy consumption of Database Management - Florina Jonuzi
 
Mobile App Development Company In Noida | Drona Infotech
Mobile App Development Company In Noida | Drona InfotechMobile App Development Company In Noida | Drona Infotech
Mobile App Development Company In Noida | Drona Infotech
 
J-Spring 2024 - Going serverless with Quarkus, GraalVM native images and AWS ...
J-Spring 2024 - Going serverless with Quarkus, GraalVM native images and AWS ...J-Spring 2024 - Going serverless with Quarkus, GraalVM native images and AWS ...
J-Spring 2024 - Going serverless with Quarkus, GraalVM native images and AWS ...
 
Using Query Store in Azure PostgreSQL to Understand Query Performance
Using Query Store in Azure PostgreSQL to Understand Query PerformanceUsing Query Store in Azure PostgreSQL to Understand Query Performance
Using Query Store in Azure PostgreSQL to Understand Query Performance
 
GreenCode-A-VSCode-Plugin--Dario-Jurisic
GreenCode-A-VSCode-Plugin--Dario-JurisicGreenCode-A-VSCode-Plugin--Dario-Jurisic
GreenCode-A-VSCode-Plugin--Dario-Jurisic
 
Webinar On-Demand: Using Flutter for Embedded
Webinar On-Demand: Using Flutter for EmbeddedWebinar On-Demand: Using Flutter for Embedded
Webinar On-Demand: Using Flutter for Embedded
 
WWDC 2024 Keynote Review: For CocoaCoders Austin
WWDC 2024 Keynote Review: For CocoaCoders AustinWWDC 2024 Keynote Review: For CocoaCoders Austin
WWDC 2024 Keynote Review: For CocoaCoders Austin
 
UI5con 2024 - Keynote: Latest News about UI5 and it’s Ecosystem
UI5con 2024 - Keynote: Latest News about UI5 and it’s EcosystemUI5con 2024 - Keynote: Latest News about UI5 and it’s Ecosystem
UI5con 2024 - Keynote: Latest News about UI5 and it’s Ecosystem
 
如何办理(hull学位证书)英国赫尔大学毕业证硕士文凭原版一模一样
如何办理(hull学位证书)英国赫尔大学毕业证硕士文凭原版一模一样如何办理(hull学位证书)英国赫尔大学毕业证硕士文凭原版一模一样
如何办理(hull学位证书)英国赫尔大学毕业证硕士文凭原版一模一样
 
How to write a program in any programming language
How to write a program in any programming languageHow to write a program in any programming language
How to write a program in any programming language
 
Microservice Teams - How the cloud changes the way we work
Microservice Teams - How the cloud changes the way we workMicroservice Teams - How the cloud changes the way we work
Microservice Teams - How the cloud changes the way we work
 
Everything You Need to Know About X-Sign: The eSign Functionality of XfilesPr...
Everything You Need to Know About X-Sign: The eSign Functionality of XfilesPr...Everything You Need to Know About X-Sign: The eSign Functionality of XfilesPr...
Everything You Need to Know About X-Sign: The eSign Functionality of XfilesPr...
 
在线购买加拿大英属哥伦比亚大学毕业证本科学位证书原版一模一样
在线购买加拿大英属哥伦比亚大学毕业证本科学位证书原版一模一样在线购买加拿大英属哥伦比亚大学毕业证本科学位证书原版一模一样
在线购买加拿大英属哥伦比亚大学毕业证本科学位证书原版一模一样
 
How Can Hiring A Mobile App Development Company Help Your Business Grow?
How Can Hiring A Mobile App Development Company Help Your Business Grow?How Can Hiring A Mobile App Development Company Help Your Business Grow?
How Can Hiring A Mobile App Development Company Help Your Business Grow?
 
14 th Edition of International conference on computer vision
14 th Edition of International conference on computer vision14 th Edition of International conference on computer vision
14 th Edition of International conference on computer vision
 
Malibou Pitch Deck For Its €3M Seed Round
Malibou Pitch Deck For Its €3M Seed RoundMalibou Pitch Deck For Its €3M Seed Round
Malibou Pitch Deck For Its €3M Seed Round
 

Xamarin.iOS introduction

  • 1. Creare app native su iOS, Android, Mac & Windows in C# Introduzione a Xamarin.iOS
  • 2. Gli speaker di oggi Guido Magrin Xamarin & Microsoft Student Partner Xamarin Certified Developer @GuidoMagrin
  • 3. Dove trovo le slide? http://www.slideshare.net/guidomagrin
  • 4. Gli Xamarin Student Partner https://www.facebook.com/XSAMilano
  • 6. Chi ha già sentito parlare di Xamarin.iOS?
  • 7. Xamarin + Xamarin.Forms Approccio offerto da Xamarin.Forms: Codice UI condiviso, controlli nativi Approccio tradizionale di Xamarin Shared UI Code
  • 8. .NET + iOS APIs | copertura al 100%
  • 9. Qualsiasi cosa si possa fare in Objective-C o Swift può essere fatta in C# con Xamarin in Visual Studio
  • 10. Xamarin è sempre aggiornato Release iOS supportate al day-one: iOS 5, iOS 6, iOS 7, iOS 7.1, iOS 8, iOS 9, iOS 10 Supporto ad Apple Watch!
  • 11. Xamarin Studio PC o Mac Plugin Visual Studio VS 2010 e superiore Ambienti di Sviluppo
  • 12. Integrazione in Visual Studio Una soluzione sola per: • iOS • Android • Windows Phone • Windows Store Tutti i plugin e le funzioni di Visual Studio: • ReSharper • Team Foundation Server
  • 13. Integrazione in Visual Studio Debugging su: • Emulatori • Dispositivi Integrati nella toolbar: • Stato • Logs • Lista di dispositivi
  • 14. Xamarin Studio • Ottimizzato per lo sviluppo cross-platform • Accedi alle API native con l’autocompletamento • Designer per Android e iOS • Debugging avanzato su emulatore o dispositivo
  • 15. Designer per Xamarin iOS • Il primo designer iOS presente in Xamarin Studio e Visual Studio • Simile al designer tradizionale di Visual Studio • Supporta pienamente l’UIKit • Modifica i componenti personalizzati e di terze parti • Modifiche grafiche applicate in tempo reale
  • 16. Cosa impareremo oggi? • Fundamentals • The package • Views and navigation • Managing lists • Working files
  • 18. Before we start... • You need a Mac: – OS X 10.9.4+ – Xcode – Xamarin.iOS • You can still work on your Windows PC: – Visual Studio – Xamarin.iOS
  • 19. Before we start... • The OS X and Windows machines have to be connected to the same network • You can connect a OS X machine only to multiple Windows machines • OS X and Windows need to have the same Xamarin.iOS version installed
  • 20. iPhone simulator • Requires the latest version of Xamarin.iOS. • Allows you to “completely forget” about your Mac. • Fun fact: given that the Windows PC has a touchscreen, it supports this kind of input.
  • 21. What if I don’t have a Mac? Rent one! • Always available. • Pay as you go. • Scalable according to our needs.
  • 22. The application • Main – It’s the entry point of the app – It creates the application • AppDelegate – It manages the system events – It has an Application Window with the UI – It starts the Main interface
  • 23. The startup • Storyboard – Takes care of initializing the main controller – The controller manages the main view and the sub views • ViewController – It receives the interactions from the views – It takes care of displaying the data on the view
  • 24. Apple Watch has Storyboards, too! • Same functionalities you would expect from iPhone storyboards. • As of today, easier to work with in terms of app rescaling.
  • 25. Model-View-Controller (MVC) • iOS is based on MVC – The Model describes the data – The View describes the UI – The Controller manages the interactions between the Model and the View
  • 27. Domanda 1 Posso creare applicazioni iOS usando esclusivamente un PC Windows a) Vero b) Falso
  • 28. Domanda 1 Posso creare applicazioni iOS usando esclusivamente un PC Windows a) Vero b) Falso
  • 29. Domanda 2 Da quali componenti è composta un’applicazione iOS? a) Main, AppDelegate b) Window, AppDelegate c) Main, ViewController d) Screen, ViewController
  • 30. Domanda 2 Da quali componenti è composta un’applicazione iOS? a) Main, AppDelegate b) Window, AppDelegate c) Main, ViewController d) Screen, ViewController
  • 32. Resources • iOS requires that all the resources are placed in the root folder • Xamarin adds a Resource folder – At compile time, the content is copied in the root • The Build Action has to be set to BundleResource
  • 33. Images • The original iPhone had a resolution of 320x480 • New resolutions have been added • Naming conventions to manage the assets: – @2x -> Retina – @3x-> iPhone 6 Plus – ~iphone -> Used on the iPhone – ~ipad -> Used on the iPad – Example: Image.png, Image@2x.png, Image2x~iphone.png
  • 34. Info.plist and Entitlements.plist iPhone Deployment info • It contains the main info about the app configuration: – Main interface – Supported orientations – Status bar style Entitlements • Used to configure iCloud, push notifications, HealthKit, etc.
  • 37. Domanda 1 Se volessi implementare iCloud nella mia app iOS, tramite quale file dovrei abilitarne l’integrazione? a) BundleResources.plist b) Info.plist c) CloudConnectivity.plist d) Entitlements.plist
  • 38. Domanda 1 Se volessi implementare iCloud nella mia app iOS, tramite quale file dovrei abilitarne l’integrazione? a) BundleResources.plist b) Info.plist c) CloudConnectivity.plist d) Entitlements.plist
  • 39. Storyboards • In the past, iOS developers managed views using the XIB files • Each XIB files was mapped with a controller • The developer needed to manually manage the navigation between two views
  • 40. Storyboards • A storyboard is the visual representation of all the screens in an app • It’s made by different scenes • A scene is a View managed by a ViewController • Scenes contains objects and controls that are used to manage interactions and to display data
  • 41. The Xamarin designer • Storyboards can’t be created in code • The underline XML is generated automatically by the designer • Xamarin offers a built-in designer, which requires a Mac Build Host connected to the Windows machine
  • 42. Navigation • Navigation in Storyboards is managed using Segues • A Segue is a transition between two scenes • Multiple transitions: – Simple navigation – Modal views – Popover • Segues are created using the designer
  • 43. Storyboards, Segues and Xamarin designer
  • 46. Domanda 1 Come si chiama il file contenente tutte le schermate della mia app iOS? a) Segues b) Storyboard c) Designer d) BuildHost
  • 47. Domanda 1 Come si chiama il file contenente tutte le schermate della mia app iOS? a) Segues b) Storyboard c) Designer d) BuildHost
  • 48. Domanda 2 Cosa uso per navigare tra le varie pagine della mia app iOS? a) Navigator b) Arrow c) Transitioner d) Segues
  • 49. Domanda 2 Cosa uso per navigare tra le varie pagine della mia app iOS? a) Navigator b) Arrow c) Transitioner d) Segues
  • 50. Passing data • A storyboards offers a method called PrepareForSegue() to override • You get a reference to the destination control and you pass the data into a property public override void PrepareForSegue(UIStoryboardSegue segue, NSObject sender) { base.PrepareForSegue(segue, sender); var controller = segue.DestinationViewController as MyPageController; controller.TextToShow = MyPhoneNumber.Text; }
  • 51. Conditional navigation • Sometimes you need to perform navigation only if a specific condition is satisfied • You can override the ShouldPerformSegue() method public override bool ShouldPerformSegue(string segueIdentifier, NSObject sender) { if (segueIdentifier == "SegueToMainPage") { if (PasswordTextField.Text == "password") return true; else return false; } return base.ShouldPerformSegue(segueIdentifier, sender); }
  • 53. The view’s lifecycle Methods intherited by the UIViewController class • ViewDidLoad – The controller has loaded the connected view • ViewWillAppear – The pagecontent is about to appear • ViewWillDisappear – The page content is about to disappear • ViewDidAppear / ViewDidDisappear – The page content is appeared / disappeared
  • 54. Alerts If you target a pre iOS 8 device, you need to use the UIAlertView class UIAlertView av = new UIAlertView("Title", "message", null, "OK", null); av.Show();
  • 55. Alerts If you target an iOS 8+ device, you can use: • UIAlertController to display an alert • UIActionSheet to display an action sheet
  • 57. Built-in applications • Same URI-based approach that you find in Windows Phone • You use the OpenUrl() method to invoke a URL NSUrl url = new NSUrl("http://www.xamarin.com"); if (UIApplication.SharedApplication.CanOpenUrl(url)) { UIApplication.SharedApplication.OpenUrl(url); }
  • 59. Table Views Many different classes and APIs to implement a list • UITableView – It’s the table that contains the rows to display • UITableViewCell – It represent a row of the list • UITableViewSource – It’s a specific Xamarin class that makes easier to implement a UITableView – On iOS, you would to implement separately the UIViewTableDataSource and UITableViewDelegate classes
  • 60. Table Views Many different classes and APIs to implement a list • NSIndexPath – It identifies a specific element of the table • UITableViewController – It’s the controller that implements an UITableView
  • 61. Table layout • Four different built-in styles • To implement a custom layout, you need to implement a custom cell
  • 62. Creating a UITableViewSource • You need to choose a cell identifier • You need to implement the GetCell() method to define the layout of a cell public class TableSource : UITableViewSource { string[] tableItems; string cellIdentifier = "TableCell"; public TableSource(string[] items) { tableItems = items; } public override nint RowsInSection(UITableView tableview, nint section) { } public override UITableViewCell GetCell(UITableView tableView, Foundation.NSIndexPath indexPath) { ... } }
  • 63. Cell reuse • It’s the technique used to improve performances in case of big collections to display • You first ask for a cell to reuse before creating a new one public override UITableViewCell GetCell(UITableView tableView, Foundation.NSIndexPath indexPath) { UITableViewCell cell = tableView.DequeueReusableCell(cellIdentifier); // if there are no cells to reuse, create a new one if (cell == null) cell = new UITableViewCell(UITableViewCellStyle.Default, cellIdentifier); cell.TextLabel.Text = tableItems[indexPath.Row]; return cell; }
  • 64. Cell reuse Starting from iO6, there’s a new method that automatically takes care of generating the proper cell for you public override UITableViewCell GetCell(UITableView tableView, NSIndexPath indexPath) { var cell = (MyCell)tableView.DequeueReusableCell(MyCellId, indexPath); return cell; }
  • 68. Domanda 1 Di quali metodi e controlli mi posso avvalere per creare una lista in un’app iOS? a) UITableView b) UITableViewContainer c) UITableViewSource d) UITableViewCell
  • 69. Domanda 1 Di quali metodi e controlli mi posso avvalere per creare una lista in un’app iOS? a) UITableView b) UITableViewContainer c) UITableViewSource d) UITableViewCell
  • 70. Domanda 2 Per implementare un Custom Layout, devo implementare una Custom Cell a) Vero b) Falso
  • 71. Domanda 2 Per implementare un Custom Layout, devo implementare una Custom Cell a) Vero b) Falso
  • 72. Domanda 3 Quante tipologie di Layout di default sono presenti? a) Due b) Quattro c) Otto d) Dodici
  • 73. Domanda 3 Quante tipologie di Layout di default sono presenti? a) Due b) Quattro c) Otto d) Dodici
  • 74. Using a custom layout • You need to create a custom cell • You can do it in code or with the designer • You add the controls inside the UIViewTableCell object • In code, you assign a value to the controls
  • 75. Using a custom layout In the UITableViewSource, you use the custom cell class instead of the base UITableViewCell one in the GetCell() method public override UITableViewCell GetCell(UITableView tableView, NSIndexPath indexPath) { CharacterCellView cell = tableView.DequeueReusableCell(CellIdentifier, indexPath) as CharacterCellView; Character currentCharacter = tableItems[indexPath.Row]; cell.UpdateCharacter(currentCharacter); return cell; }
  • 78. Files and folders • To create files and folder you can leverage the basic .NET APIs (System.IO) • Documents is the base path where all the files of the application are stored • In the info.plist you can set the option UIFileSharingEnabled to true to allow access to local files through iTunes
  • 79. The folders • Library – To store the internal files of the application – It’s automatically backed up • Library/Preferences – To store the application settings – It’s automatically backed up • Library/Caches – iOS can delete the content in case the space is going low – It’s not backed up
  • 80. Working with files and folders DEMO
  • 81. Grazie per l’attenzione  Guido Magrin Xamarin Student Partner @GuidoMagrin

Editor's Notes

  1. We see here the Xamarin approach we talked about earlier This enables you to be highly productive, share code, but build out UI on each platform and access platform APIs With Xamarin.Forms you now have a nice Shared UI Code layer, but still access to platform APIs You can start from native, pick a few screens, or start with forms, and replace with native later
  2. Lo stesso avviene quindi per iOS e Android, mentre si usa Xamarin. Tutte le API native di iOS sono state coperte da Xamarin in C#.
  3. Grazie alla developer preview di Apple, Xamarin è stata in grado di rilasciare il support fin da subito per queste release di iOS. Google però non offre una developer preview, e quindi bisogna aspettare circa 4-8 settimane per avere una release stabile. E’ importante notare come il supporto a dispositivo come Android Wear e Apple Watch si esprima anche con il debugging da appositi emulatori realizzati da Xamarin.
  4. Xamarin Studio PC -> Android Mac -> iOS, Android, Mac Visual Studio: iOS, Android Windows
  5. Il plugin supporta Visual Studio 2010, 2012, 2013 e 2015 Supporta le desktop app su Windows: WPF, ASP.NET, Silverlight, WinForms Soluzioni e progetti possono esssere aperti indistintamente in Xamarin Studio e Visual Studio
  6. AGGIORNARE SCREEN
  7. Xamarin Studio su PC consente solamente Android, su Mac Android, iOS e Mac. Xamarin Studio consente di lavorare con Git e altri sistemi di source control.
  8. Xamarin Introduction!
  9. Xamarin Introduction!
  10. Xamarin Introduction!
  11. Xamarin Introduction!
  12. Xamarin Introduction!
  13. Xamarin Introduction!
  14. Xamarin Introduction!
  15. Xamarin Introduction!
  16. Xamarin Introduction!
  17. Xamarin Introduction!
  18. Xamarin Introduction!