SlideShare uma empresa Scribd logo
1 de 81
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

Mais conteúdo relacionado

Mais procurados

Learning C# iPad Programming
Learning C# iPad ProgrammingLearning C# iPad Programming
Learning C# iPad ProgrammingRich Helton
 
Native Script Overview
Native Script OverviewNative Script Overview
Native Script OverviewBaskar rao Dsn
 
Appcelerator Titanium Intro
Appcelerator Titanium IntroAppcelerator Titanium Intro
Appcelerator Titanium IntroNicholas Jansma
 
Ionic framework one day training
Ionic framework one day trainingIonic framework one day training
Ionic framework one day trainingTroy 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 LeaksAxway 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 overviewBaskar rao Dsn
 
Native Mobile Apps, Xamarin, and PhoneGap
Native Mobile Apps, Xamarin, and PhoneGapNative Mobile Apps, Xamarin, and PhoneGap
Native Mobile Apps, Xamarin, and PhoneGapSasha 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 3Oleksandr 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 threadRonald Treur
 
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 FrameworkTroy Miles
 
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 AppsShailendra 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 2016Jad Salhani
 
Hybrid Apps with Ionic Framework
Hybrid Apps with Ionic FrameworkHybrid Apps with Ionic Framework
Hybrid Apps with Ionic FrameworkBramus Van Damme
 

Mais procurados (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
 

Semelhante a Xamarin.iOS introduction

Xamarin.Mac Introduction
Xamarin.Mac IntroductionXamarin.Mac Introduction
Xamarin.Mac IntroductionMiguel 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 XamarinGill 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 StudioIndyMobileNetDev
 
Xamarin Platform
Xamarin PlatformXamarin Platform
Xamarin PlatformRui Marinho
 
08 mobile development
08   mobile development08   mobile development
08 mobile developmentdarwinodb
 
Xamarin.Android Introduction
Xamarin.Android IntroductionXamarin.Android Introduction
Xamarin.Android IntroductionGuido Magrin
 
Android Application Development Using Java
Android Application Development Using JavaAndroid Application Development Using Java
Android Application Development Using Javaamaankhan
 
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 XamarinGill 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 GuyNick 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 multiplataformaAllan Cleysson
 
Introduction to Xamarin
Introduction to XamarinIntroduction to Xamarin
Introduction to XamarinBrian Anderson
 
Appium Overview - by Daniel Puterman
Appium Overview - by Daniel PutermanAppium Overview - by Daniel Puterman
Appium Overview - by Daniel PutermanApplitools
 
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 StudioCraig 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 1drudolph11
 
Introduction to Xamarin
Introduction to XamarinIntroduction to Xamarin
Introduction to XamarinGuy 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 MakmalOfir Makmal
 

Semelhante a 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
 

Mais de 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.FormsGuido Magrin
 
LGL Team - UniShare & UniBuy
LGL Team -  UniShare & UniBuyLGL Team -  UniShare & UniBuy
LGL Team - UniShare & UniBuyGuido Magrin
 
Evius Presentation
Evius PresentationEvius Presentation
Evius PresentationGuido Magrin
 
Enel Smart Info presentation
Enel Smart Info presentationEnel Smart Info presentation
Enel Smart Info presentationGuido Magrin
 
Xamarin.Forms Introduction
Xamarin.Forms IntroductionXamarin.Forms Introduction
Xamarin.Forms IntroductionGuido Magrin
 
Microsoft Azure Websites
Microsoft Azure WebsitesMicrosoft Azure Websites
Microsoft Azure WebsitesGuido Magrin
 
Introduction to Xamarin
Introduction to XamarinIntroduction to Xamarin
Introduction to XamarinGuido Magrin
 

Mais de 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
 

Último

HR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.comHR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.comFatema Valibhai
 
Advancing Engineering with AI through the Next Generation of Strategic Projec...
Advancing Engineering with AI through the Next Generation of Strategic Projec...Advancing Engineering with AI through the Next Generation of Strategic Projec...
Advancing Engineering with AI through the Next Generation of Strategic Projec...OnePlan Solutions
 
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...harshavardhanraghave
 
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...kellynguyen01
 
Cloud Management Software Platforms: OpenStack
Cloud Management Software Platforms: OpenStackCloud Management Software Platforms: OpenStack
Cloud Management Software Platforms: OpenStackVICTOR MAESTRE RAMIREZ
 
What is Binary Language? Computer Number Systems
What is Binary Language?  Computer Number SystemsWhat is Binary Language?  Computer Number Systems
What is Binary Language? Computer Number SystemsJheuzeDellosa
 
Unveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time ApplicationsUnveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time ApplicationsAlberto González Trastoy
 
Adobe Marketo Engage Deep Dives: Using Webhooks to Transfer Data
Adobe Marketo Engage Deep Dives: Using Webhooks to Transfer DataAdobe Marketo Engage Deep Dives: Using Webhooks to Transfer Data
Adobe Marketo Engage Deep Dives: Using Webhooks to Transfer DataBradBedford3
 
The Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdfThe Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdfkalichargn70th171
 
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...gurkirankumar98700
 
How To Use Server-Side Rendering with Nuxt.js
How To Use Server-Side Rendering with Nuxt.jsHow To Use Server-Side Rendering with Nuxt.js
How To Use Server-Side Rendering with Nuxt.jsAndolasoft Inc
 
A Secure and Reliable Document Management System is Essential.docx
A Secure and Reliable Document Management System is Essential.docxA Secure and Reliable Document Management System is Essential.docx
A Secure and Reliable Document Management System is Essential.docxComplianceQuest1
 
Unlocking the Future of AI Agents with Large Language Models
Unlocking the Future of AI Agents with Large Language ModelsUnlocking the Future of AI Agents with Large Language Models
Unlocking the Future of AI Agents with Large Language Modelsaagamshah0812
 
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...stazi3110
 
Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...
Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...
Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...soniya singh
 
DNT_Corporate presentation know about us
DNT_Corporate presentation know about usDNT_Corporate presentation know about us
DNT_Corporate presentation know about usDynamic Netsoft
 
Software Quality Assurance Interview Questions
Software Quality Assurance Interview QuestionsSoftware Quality Assurance Interview Questions
Software Quality Assurance Interview QuestionsArshad QA
 
Der Spagat zwischen BIAS und FAIRNESS (2024)
Der Spagat zwischen BIAS und FAIRNESS (2024)Der Spagat zwischen BIAS und FAIRNESS (2024)
Der Spagat zwischen BIAS und FAIRNESS (2024)OPEN KNOWLEDGE GmbH
 
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...OnePlan Solutions
 

Último (20)

HR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.comHR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.com
 
Advancing Engineering with AI through the Next Generation of Strategic Projec...
Advancing Engineering with AI through the Next Generation of Strategic Projec...Advancing Engineering with AI through the Next Generation of Strategic Projec...
Advancing Engineering with AI through the Next Generation of Strategic Projec...
 
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
 
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
 
Cloud Management Software Platforms: OpenStack
Cloud Management Software Platforms: OpenStackCloud Management Software Platforms: OpenStack
Cloud Management Software Platforms: OpenStack
 
What is Binary Language? Computer Number Systems
What is Binary Language?  Computer Number SystemsWhat is Binary Language?  Computer Number Systems
What is Binary Language? Computer Number Systems
 
Unveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time ApplicationsUnveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
 
Adobe Marketo Engage Deep Dives: Using Webhooks to Transfer Data
Adobe Marketo Engage Deep Dives: Using Webhooks to Transfer DataAdobe Marketo Engage Deep Dives: Using Webhooks to Transfer Data
Adobe Marketo Engage Deep Dives: Using Webhooks to Transfer Data
 
The Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdfThe Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdf
 
Call Girls In Mukherjee Nagar 📱 9999965857 🤩 Delhi 🫦 HOT AND SEXY VVIP 🍎 SE...
Call Girls In Mukherjee Nagar 📱  9999965857  🤩 Delhi 🫦 HOT AND SEXY VVIP 🍎 SE...Call Girls In Mukherjee Nagar 📱  9999965857  🤩 Delhi 🫦 HOT AND SEXY VVIP 🍎 SE...
Call Girls In Mukherjee Nagar 📱 9999965857 🤩 Delhi 🫦 HOT AND SEXY VVIP 🍎 SE...
 
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...
 
How To Use Server-Side Rendering with Nuxt.js
How To Use Server-Side Rendering with Nuxt.jsHow To Use Server-Side Rendering with Nuxt.js
How To Use Server-Side Rendering with Nuxt.js
 
A Secure and Reliable Document Management System is Essential.docx
A Secure and Reliable Document Management System is Essential.docxA Secure and Reliable Document Management System is Essential.docx
A Secure and Reliable Document Management System is Essential.docx
 
Unlocking the Future of AI Agents with Large Language Models
Unlocking the Future of AI Agents with Large Language ModelsUnlocking the Future of AI Agents with Large Language Models
Unlocking the Future of AI Agents with Large Language Models
 
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...
 
Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...
Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...
Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...
 
DNT_Corporate presentation know about us
DNT_Corporate presentation know about usDNT_Corporate presentation know about us
DNT_Corporate presentation know about us
 
Software Quality Assurance Interview Questions
Software Quality Assurance Interview QuestionsSoftware Quality Assurance Interview Questions
Software Quality Assurance Interview Questions
 
Der Spagat zwischen BIAS und FAIRNESS (2024)
Der Spagat zwischen BIAS und FAIRNESS (2024)Der Spagat zwischen BIAS und FAIRNESS (2024)
Der Spagat zwischen BIAS und FAIRNESS (2024)
 
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...
 

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

Notas do Editor

  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!