SlideShare uma empresa Scribd logo
1 de 45
Corso WebApp iOS
              “iOS WebApp Anatomy”
                                    Lezione 07/10

”if everything seems under control..
..you’re not going fast enought!”
  Mario Andretti
   1978 Formula 1 World Champion.
Chapter 08
Native iOS Enviroment Development


Chapter 09
Native iOS Design Implementation




   http://www.apress.com/9781430232469
Diario Lezioni
            LEZIONE 06

      iOS WebApp Anatomy
 Eumulare l’Interfaccia Nativa iOS
 Interagire con i Servizi Nativi iOS
iOS UI Emulation
                  compartamento di default

<meta name="viewport" content="width=980; user-scalable=1;"/>
iOS UI Emulation
                esempio di alcune proprietà

<meta name="viewport" content="width=device-width;
initial-scale=1.0; maximum-scale=1.0; user-scalable=no;"/>
iOS UI Emulation
                 valori viewport* iOS

width=768 (device-width in px for iPad on)
width=480 (device-width in px for iPhone4 on)
width=320 (device-width in px for iPhone 2G, 3G, 3GS)




                     * portrait mode
iOS UI Emulation
iOS UI Emulation
                   WebApp in Full-Screen

<meta name="apple-mobile-web-app-capable" content="yes" />
iOS UI Emulation
iOS UI Emulation
                    Custom* Status Bar

<meta name="apple-mobile-web-app-status-bar-style"
content="black-translucent" />




        * valori possibili: grey, black, black-translucent
iOS UI Emulation
             default: grey
iOS UI Emulation
                     Springboard Icon

<link rel="apple-touch-icon" href="/the-store.png"/>




        * valori possibili: grey, black, black-translucent
iOS UI Emulation
        Springboard Icon

  72x72px (iPad on)
  114x114px (iPhone4 on)
  57x57px (iPhone 2G, 3G, 3GS)
iOS UI Emulation
iOS UI Emulation
iOS UI Emulation
            Startup Image

<link rel="apple-touch-startup-image"
href="/startup-image.png">
iOS UI Emulation
          Startup Image*

  768x1004px (iPad on)
  480x940px (iPhone4 on)
  320x460px (iPhone 2G, 3G, 3GS)




           * portrait mode
iOS UI Emulation
iOS UI Emulation
            Desktop to WebApp Redirection (Media Query)

<link rel="stylesheet" media="all and (max-device-width: 480px)" href="iphone.css">

<link rel="stylesheet" media="all and (min-device-width: 481px)
   and (max-device-width: 1024px) and (orientation:portrait)" href="ipad-portrait.css">

<link rel="stylesheet" media="all and (min-device-width: 481px)
   and (max-device-width: 1024px) and (orientation:landscape)" href="ipad-landscape.css">

<link rel="stylesheet" media="all and (min-device-width: 1025px)" href="ipad-landscape.css">
iOS UI Emulation
               Desktop to WebApp Redirection (Javascript)

<script>
if ((navigator.userAgent.indexOf('iPhone') != -1) || (navigator.userAgent.indexOf('iPod') != -1)
|| (navigator.userAgent.indexOf('iPad') != -1)) {
            document.location = "http://www.mobile.thestore.com/";
       }
</script>
iOS UI Emulation
       Native Link Emulation

 *{
      -webkit-user-select: none;
 }

 .copiable {
      -webkit-user-select: text;
 }
iOS UI Emulation
iOS UI Emulation
            Native Scrolling

 .scrollableElement {
     overflow-y: scroll;
     -webkit-overflow-scrolling: touch;
 }
Diario Lezioni
            LEZIONE 06

      iOS WebApp Anatomy
 Eumulare l’Interfaccia Nativa iOS
 Interagire con i Servizi Nativi iOS
iOS Service Interaction
                     Phone App

<a href="tel:1–305-555–5555">Call 1–305-555–5555</a>
iOS Service Interaction
                          Phone App

<a href="tel:1–305-555–5555"
onclick="return (navigator.userAgent.indexOf('iPhone') != -1)">
1–305-555–5555</a>
iOS Service Interaction
iOS Service Interaction
                       Mail App

<a href="mailto:info@andreapicchi.it">Andrea Picchi</a>
iOS Service Interaction
                       Mail App

<a href="mailto:info@thestore.com">Email the Support</a>
iOS Service Interaction
                  Messages App

 <a href="sms:1–305-555–5555">SMS the Support</a>
iOS Service Interaction
                    Maps App

 <a href="sms:1–305-555–5555">SMS the Support</a>
iOS Service Interaction
                     Maps App

<a href="http://maps.google.com/maps?q=largo+bruno
      +pontecorvo+43,+pisa,+italy+(Dipartimento
+Informatica)&t=h&z=7">Dipartimento Informatica</a>
iOS Service Interaction
iOS Service Interaction
                     GPS

    possibile accedere alle coordinate GPS
          attraverso API Javascript*




                * da iOS3 in poi
iOS Service Interaction
                  GPS

      metodi definiti sull’oggetto
        navigator.geolocation




             * da iOS3 in poi
iOS Service Interaction
                     GPS

     If (window.navigator.geolocation) {
         /* API available, code here */
     } else {
         /* Fallback message */
     }




                * da iOS3 in poi
iOS Service Interaction
                             GPS*

 window.navigator.geolocation.getCurrentPosition(
    function(position) {
      /* do something using position object data */
    }
 );




          * chiamata asincrona per gestire ritardo GPS
iOS Service Interaction
                               GPS: Proprieta Oggetto Position

      position.timestamp                     Time at which the location information was determined (milliseconds)

   position.coords.accuracy        The accuracy of the latitude/longitude information returned (meters; the lower, the better)

    position.coords.latitude                              The user’s current latitude (decimal degrees)

   position.coords.longitude                             The user’s current longitude (decimal degrees)

position.coords.altitudeAccuracy      The accuracy of the altitude information returned (meters). This is often set to null

    position.coords.altitude                    The user’s current altitude (meters). The same restrictions apply

    position.coords.heading           The direction in which the user is heading (decimal degrees). This is often set to null

     position.coords.speed                   The user’s current speed. The same restrictions apply (meters/second)
iOS Service Interaction
              GPS: Gestione Errori

   non tutti i dati possono essere disponibili

                  alcuni esempi:
      errori utente (rifiuto tracciamento)
       errori sistema (mancanza di dati)
iOS Service Interaction
          GPS: Gestione Errori

          getCurrentPosition()

     accetta un parametro opzionale
        usato per gestire gli errori
iOS Service Interaction
                            GPS: Gestione Errori

/* Request the user's position */
window.navigator.geolocation.getCurrentPosition(successCallback, failureCallback);

function successCallback(position) {
  /* Do something with position object data */
}

function failureCallback(error) {
  /* Do something with error object */
}
iOS Service Interaction
                  GPS: Gestione Errori

   error.code                    error.UNKNOWN_ERROR (0)


                                error.PERMISSION_DENIED (1)


                              error.POSITION_UNAVAILABLE (2)


                                      error.TIMEOUT (3)


  error.message        A message describing what happened (debug purpose)
iOS Service Interaction
              GPS: Gestione Errori

          se successCallback() fallisce
        viene chiamata failureCallback()

       controllare da dove viene l’errore
    getCurrentPosition() o successCallback()
Esercitazione
 Utilizzare Guida* di Riferimento
   del Framework e Javascript

1. Implementare le Funzioni Specifiche
2. Implementare la Logica della Dinamica




* versione online e/o formato elettronico
PROSSIMA LEZIONE
         LEGGERE

   Ottimizzazione WebApp
       Offline WebApp
         Mobile SEO

Mais conteúdo relacionado

Semelhante a Corso WebApp iOS - Lezione 07: iOS WebApp Anatomy

Windows phone 7 series
Windows phone 7 seriesWindows phone 7 series
Windows phone 7 series
openbala
 
Android app development basics
Android app development basicsAndroid app development basics
Android app development basics
Anton Narusberg
 
Android Development w/ ArcGIS Server - Esri Dev Meetup - Charlotte, NC
Android Development w/ ArcGIS Server - Esri Dev Meetup - Charlotte, NCAndroid Development w/ ArcGIS Server - Esri Dev Meetup - Charlotte, NC
Android Development w/ ArcGIS Server - Esri Dev Meetup - Charlotte, NC
Jim Tochterman
 
Mobile webapplication development
Mobile webapplication developmentMobile webapplication development
Mobile webapplication development
Ganesh Gembali
 

Semelhante a Corso WebApp iOS - Lezione 07: iOS WebApp Anatomy (20)

mobl
moblmobl
mobl
 
Making your site mobile-friendly - DevCSI Reading 21.07.2010
Making your site mobile-friendly - DevCSI Reading 21.07.2010Making your site mobile-friendly - DevCSI Reading 21.07.2010
Making your site mobile-friendly - DevCSI Reading 21.07.2010
 
HTML5 on Mobile
HTML5 on MobileHTML5 on Mobile
HTML5 on Mobile
 
3 Approaches to Mobile - An A to Z Primer.
3 Approaches to Mobile - An A to Z Primer.3 Approaches to Mobile - An A to Z Primer.
3 Approaches to Mobile - An A to Z Primer.
 
Adopting 3D Touch in your apps
Adopting 3D Touch in your appsAdopting 3D Touch in your apps
Adopting 3D Touch in your apps
 
Windows phone 7 series
Windows phone 7 seriesWindows phone 7 series
Windows phone 7 series
 
2013 URISA Track, Kickstarter for JavaScript Web and Mobile GIS Development b...
2013 URISA Track, Kickstarter for JavaScript Web and Mobile GIS Development b...2013 URISA Track, Kickstarter for JavaScript Web and Mobile GIS Development b...
2013 URISA Track, Kickstarter for JavaScript Web and Mobile GIS Development b...
 
Location Based Services Without the Cocoa
Location Based Services Without the CocoaLocation Based Services Without the Cocoa
Location Based Services Without the Cocoa
 
Developing AIR for Mobile with Flash Professional CS5.5
Developing AIR for Mobile with Flash Professional CS5.5Developing AIR for Mobile with Flash Professional CS5.5
Developing AIR for Mobile with Flash Professional CS5.5
 
Firefox OS and the Internet of Things - NDC London 2014
Firefox OS and the Internet of Things - NDC London 2014Firefox OS and the Internet of Things - NDC London 2014
Firefox OS and the Internet of Things - NDC London 2014
 
Slightly Advanced Android Wear ;)
Slightly Advanced Android Wear ;)Slightly Advanced Android Wear ;)
Slightly Advanced Android Wear ;)
 
android level 3
android level 3android level 3
android level 3
 
Mobile HTML, CSS, and JavaScript
Mobile HTML, CSS, and JavaScriptMobile HTML, CSS, and JavaScript
Mobile HTML, CSS, and JavaScript
 
Android app development basics
Android app development basicsAndroid app development basics
Android app development basics
 
GDG GeorgeTown Devfest 2014 Presentation: Android Wear: A Developer's Perspec...
GDG GeorgeTown Devfest 2014 Presentation: Android Wear: A Developer's Perspec...GDG GeorgeTown Devfest 2014 Presentation: Android Wear: A Developer's Perspec...
GDG GeorgeTown Devfest 2014 Presentation: Android Wear: A Developer's Perspec...
 
Android Development w/ ArcGIS Server - Esri Dev Meetup - Charlotte, NC
Android Development w/ ArcGIS Server - Esri Dev Meetup - Charlotte, NCAndroid Development w/ ArcGIS Server - Esri Dev Meetup - Charlotte, NC
Android Development w/ ArcGIS Server - Esri Dev Meetup - Charlotte, NC
 
Bibliotecas Google para iOS: Fanboy é a sua vó
Bibliotecas Google para iOS: Fanboy é a sua vóBibliotecas Google para iOS: Fanboy é a sua vó
Bibliotecas Google para iOS: Fanboy é a sua vó
 
Develop a native application that uses GPS location.pptx
Develop a native application that uses GPS location.pptxDevelop a native application that uses GPS location.pptx
Develop a native application that uses GPS location.pptx
 
Academy PRO: React native - miscellaneous
Academy PRO: React native - miscellaneousAcademy PRO: React native - miscellaneous
Academy PRO: React native - miscellaneous
 
Mobile webapplication development
Mobile webapplication developmentMobile webapplication development
Mobile webapplication development
 

Mais de Andrea Picchi

Continuous Innovation: Going beyond Agile, Lean, and Design Thinking toward a...
Continuous Innovation: Going beyond Agile, Lean, and Design Thinking toward a...Continuous Innovation: Going beyond Agile, Lean, and Design Thinking toward a...
Continuous Innovation: Going beyond Agile, Lean, and Design Thinking toward a...
Andrea Picchi
 
Corso WebApp iOS - Lezione 06: Web Development for iOS Devices
Corso WebApp iOS - Lezione 06:   Web Development for iOS DevicesCorso WebApp iOS - Lezione 06:   Web Development for iOS Devices
Corso WebApp iOS - Lezione 06: Web Development for iOS Devices
Andrea Picchi
 
Corso WebApp iOS - Lezione 05: Mobile Touch Development
Corso WebApp iOS - Lezione 05: Mobile Touch DevelopmentCorso WebApp iOS - Lezione 05: Mobile Touch Development
Corso WebApp iOS - Lezione 05: Mobile Touch Development
Andrea Picchi
 

Mais de Andrea Picchi (20)

The New Retail Paradigm: How the Psychological Foundation of Consumer Behavio...
The New Retail Paradigm: How the Psychological Foundation of Consumer Behavio...The New Retail Paradigm: How the Psychological Foundation of Consumer Behavio...
The New Retail Paradigm: How the Psychological Foundation of Consumer Behavio...
 
The 3 Dimensions of Design: A Model to scale the Human-Centered Problem-Solvi...
The 3 Dimensions of Design: A Model to scale the Human-Centered Problem-Solvi...The 3 Dimensions of Design: A Model to scale the Human-Centered Problem-Solvi...
The 3 Dimensions of Design: A Model to scale the Human-Centered Problem-Solvi...
 
The Evolution of Design Thinking: Shifting from a Product and Service to a Re...
The Evolution of Design Thinking: Shifting from a Product and Service to a Re...The Evolution of Design Thinking: Shifting from a Product and Service to a Re...
The Evolution of Design Thinking: Shifting from a Product and Service to a Re...
 
Continuous Innovation: Going beyond Agile, Lean, and Design Thinking toward a...
Continuous Innovation: Going beyond Agile, Lean, and Design Thinking toward a...Continuous Innovation: Going beyond Agile, Lean, and Design Thinking toward a...
Continuous Innovation: Going beyond Agile, Lean, and Design Thinking toward a...
 
The 3 Dimensions of Design: Scaling a Human-Centered Practice across the Orga...
The 3 Dimensions of Design: Scaling a Human-Centered Practice across the Orga...The 3 Dimensions of Design: Scaling a Human-Centered Practice across the Orga...
The 3 Dimensions of Design: Scaling a Human-Centered Practice across the Orga...
 
Beyond Design Thinking the 3 Dimension of a Design-Driven Company.
Beyond Design Thinking the 3 Dimension of a Design-Driven Company.Beyond Design Thinking the 3 Dimension of a Design-Driven Company.
Beyond Design Thinking the 3 Dimension of a Design-Driven Company.
 
Embedding Design Thinking at Sony to accomplish Business Strategy
Embedding Design Thinking at Sony to accomplish Business StrategyEmbedding Design Thinking at Sony to accomplish Business Strategy
Embedding Design Thinking at Sony to accomplish Business Strategy
 
How a Design-Driven Company can Multiply its Business Value
How a Design-Driven Company can Multiply its Business ValueHow a Design-Driven Company can Multiply its Business Value
How a Design-Driven Company can Multiply its Business Value
 
The Evolution of Business Strategy: How to use Design Thinking to uncover hid...
The Evolution of Business Strategy: How to use Design Thinking to uncover hid...The Evolution of Business Strategy: How to use Design Thinking to uncover hid...
The Evolution of Business Strategy: How to use Design Thinking to uncover hid...
 
A Cognitive Approach to Ecosystem Design
A Cognitive Approach to Ecosystem DesignA Cognitive Approach to Ecosystem Design
A Cognitive Approach to Ecosystem Design
 
Variabili Cognitive dell'Esperienza Utente
Variabili Cognitive dell'Esperienza UtenteVariabili Cognitive dell'Esperienza Utente
Variabili Cognitive dell'Esperienza Utente
 
Ottimizzazione Cognitiva di Contesti Mobile Touch
Ottimizzazione Cognitiva di Contesti Mobile TouchOttimizzazione Cognitiva di Contesti Mobile Touch
Ottimizzazione Cognitiva di Contesti Mobile Touch
 
Ottimizzazione e Analisi Cognitiva di Contesti Mobile Touch
Ottimizzazione e Analisi Cognitiva di Contesti Mobile TouchOttimizzazione e Analisi Cognitiva di Contesti Mobile Touch
Ottimizzazione e Analisi Cognitiva di Contesti Mobile Touch
 
Corso WebApp iOS - Lezione 09: Testing iOS WebApp
Corso WebApp iOS - Lezione 09: Testing iOS WebAppCorso WebApp iOS - Lezione 09: Testing iOS WebApp
Corso WebApp iOS - Lezione 09: Testing iOS WebApp
 
Corso WebApp iOS - Lezione 08: Optimize iOS WebApp
Corso WebApp iOS - Lezione 08: Optimize iOS WebAppCorso WebApp iOS - Lezione 08: Optimize iOS WebApp
Corso WebApp iOS - Lezione 08: Optimize iOS WebApp
 
Corso WebApp iOS - Lezione 06: Web Development for iOS Devices
Corso WebApp iOS - Lezione 06:   Web Development for iOS DevicesCorso WebApp iOS - Lezione 06:   Web Development for iOS Devices
Corso WebApp iOS - Lezione 06: Web Development for iOS Devices
 
Corso WebApp iOS - Lezione 05: Mobile Touch Development
Corso WebApp iOS - Lezione 05: Mobile Touch DevelopmentCorso WebApp iOS - Lezione 05: Mobile Touch Development
Corso WebApp iOS - Lezione 05: Mobile Touch Development
 
Corso WebApp iOS - Lezione 04: iOS UI Design
Corso WebApp iOS - Lezione 04: iOS UI DesignCorso WebApp iOS - Lezione 04: iOS UI Design
Corso WebApp iOS - Lezione 04: iOS UI Design
 
Corso WebApp iOS - Lezione 03: Cognitive User Interface Design
Corso WebApp iOS - Lezione 03: Cognitive User Interface DesignCorso WebApp iOS - Lezione 03: Cognitive User Interface Design
Corso WebApp iOS - Lezione 03: Cognitive User Interface Design
 
Corso WebApp iOS - Lezione 02: Design Touch Mobile
Corso WebApp iOS - Lezione 02: Design Touch MobileCorso WebApp iOS - Lezione 02: Design Touch Mobile
Corso WebApp iOS - Lezione 02: Design Touch Mobile
 

Último

Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
Joaquim Jorge
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slide
vu2urc
 

Último (20)

Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CV
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
 
Developing An App To Navigate The Roads of Brazil
Developing An App To Navigate The Roads of BrazilDeveloping An App To Navigate The Roads of Brazil
Developing An App To Navigate The Roads of Brazil
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slide
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a Fresher
 
Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024
 
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUnderstanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
 
Advantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your BusinessAdvantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your Business
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organization
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
 
GenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdfGenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdf
 
Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...
 
A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
 

Corso WebApp iOS - Lezione 07: iOS WebApp Anatomy

  • 1. Corso WebApp iOS “iOS WebApp Anatomy” Lezione 07/10 ”if everything seems under control.. ..you’re not going fast enought!” Mario Andretti 1978 Formula 1 World Champion.
  • 2. Chapter 08 Native iOS Enviroment Development Chapter 09 Native iOS Design Implementation http://www.apress.com/9781430232469
  • 3. Diario Lezioni LEZIONE 06 iOS WebApp Anatomy Eumulare l’Interfaccia Nativa iOS Interagire con i Servizi Nativi iOS
  • 4. iOS UI Emulation compartamento di default <meta name="viewport" content="width=980; user-scalable=1;"/>
  • 5. iOS UI Emulation esempio di alcune proprietà <meta name="viewport" content="width=device-width; initial-scale=1.0; maximum-scale=1.0; user-scalable=no;"/>
  • 6. iOS UI Emulation valori viewport* iOS width=768 (device-width in px for iPad on) width=480 (device-width in px for iPhone4 on) width=320 (device-width in px for iPhone 2G, 3G, 3GS) * portrait mode
  • 8. iOS UI Emulation WebApp in Full-Screen <meta name="apple-mobile-web-app-capable" content="yes" />
  • 10. iOS UI Emulation Custom* Status Bar <meta name="apple-mobile-web-app-status-bar-style" content="black-translucent" /> * valori possibili: grey, black, black-translucent
  • 11. iOS UI Emulation default: grey
  • 12. iOS UI Emulation Springboard Icon <link rel="apple-touch-icon" href="/the-store.png"/> * valori possibili: grey, black, black-translucent
  • 13. iOS UI Emulation Springboard Icon 72x72px (iPad on) 114x114px (iPhone4 on) 57x57px (iPhone 2G, 3G, 3GS)
  • 16. iOS UI Emulation Startup Image <link rel="apple-touch-startup-image" href="/startup-image.png">
  • 17. iOS UI Emulation Startup Image* 768x1004px (iPad on) 480x940px (iPhone4 on) 320x460px (iPhone 2G, 3G, 3GS) * portrait mode
  • 19. iOS UI Emulation Desktop to WebApp Redirection (Media Query) <link rel="stylesheet" media="all and (max-device-width: 480px)" href="iphone.css"> <link rel="stylesheet" media="all and (min-device-width: 481px) and (max-device-width: 1024px) and (orientation:portrait)" href="ipad-portrait.css"> <link rel="stylesheet" media="all and (min-device-width: 481px) and (max-device-width: 1024px) and (orientation:landscape)" href="ipad-landscape.css"> <link rel="stylesheet" media="all and (min-device-width: 1025px)" href="ipad-landscape.css">
  • 20. iOS UI Emulation Desktop to WebApp Redirection (Javascript) <script> if ((navigator.userAgent.indexOf('iPhone') != -1) || (navigator.userAgent.indexOf('iPod') != -1) || (navigator.userAgent.indexOf('iPad') != -1)) { document.location = "http://www.mobile.thestore.com/"; } </script>
  • 21. iOS UI Emulation Native Link Emulation *{ -webkit-user-select: none; } .copiable { -webkit-user-select: text; }
  • 23. iOS UI Emulation Native Scrolling .scrollableElement { overflow-y: scroll; -webkit-overflow-scrolling: touch; }
  • 24. Diario Lezioni LEZIONE 06 iOS WebApp Anatomy Eumulare l’Interfaccia Nativa iOS Interagire con i Servizi Nativi iOS
  • 25. iOS Service Interaction Phone App <a href="tel:1–305-555–5555">Call 1–305-555–5555</a>
  • 26. iOS Service Interaction Phone App <a href="tel:1–305-555–5555" onclick="return (navigator.userAgent.indexOf('iPhone') != -1)"> 1–305-555–5555</a>
  • 28. iOS Service Interaction Mail App <a href="mailto:info@andreapicchi.it">Andrea Picchi</a>
  • 29. iOS Service Interaction Mail App <a href="mailto:info@thestore.com">Email the Support</a>
  • 30. iOS Service Interaction Messages App <a href="sms:1–305-555–5555">SMS the Support</a>
  • 31. iOS Service Interaction Maps App <a href="sms:1–305-555–5555">SMS the Support</a>
  • 32. iOS Service Interaction Maps App <a href="http://maps.google.com/maps?q=largo+bruno +pontecorvo+43,+pisa,+italy+(Dipartimento +Informatica)&t=h&z=7">Dipartimento Informatica</a>
  • 34. iOS Service Interaction GPS possibile accedere alle coordinate GPS attraverso API Javascript* * da iOS3 in poi
  • 35. iOS Service Interaction GPS metodi definiti sull’oggetto navigator.geolocation * da iOS3 in poi
  • 36. iOS Service Interaction GPS If (window.navigator.geolocation) { /* API available, code here */ } else { /* Fallback message */ } * da iOS3 in poi
  • 37. iOS Service Interaction GPS* window.navigator.geolocation.getCurrentPosition( function(position) { /* do something using position object data */ } ); * chiamata asincrona per gestire ritardo GPS
  • 38. iOS Service Interaction GPS: Proprieta Oggetto Position position.timestamp Time at which the location information was determined (milliseconds) position.coords.accuracy The accuracy of the latitude/longitude information returned (meters; the lower, the better) position.coords.latitude The user’s current latitude (decimal degrees) position.coords.longitude The user’s current longitude (decimal degrees) position.coords.altitudeAccuracy The accuracy of the altitude information returned (meters). This is often set to null position.coords.altitude The user’s current altitude (meters). The same restrictions apply position.coords.heading The direction in which the user is heading (decimal degrees). This is often set to null position.coords.speed The user’s current speed. The same restrictions apply (meters/second)
  • 39. iOS Service Interaction GPS: Gestione Errori non tutti i dati possono essere disponibili alcuni esempi: errori utente (rifiuto tracciamento) errori sistema (mancanza di dati)
  • 40. iOS Service Interaction GPS: Gestione Errori getCurrentPosition() accetta un parametro opzionale usato per gestire gli errori
  • 41. iOS Service Interaction GPS: Gestione Errori /* Request the user's position */ window.navigator.geolocation.getCurrentPosition(successCallback, failureCallback); function successCallback(position) { /* Do something with position object data */ } function failureCallback(error) { /* Do something with error object */ }
  • 42. iOS Service Interaction GPS: Gestione Errori error.code error.UNKNOWN_ERROR (0) error.PERMISSION_DENIED (1) error.POSITION_UNAVAILABLE (2) error.TIMEOUT (3) error.message A message describing what happened (debug purpose)
  • 43. iOS Service Interaction GPS: Gestione Errori se successCallback() fallisce viene chiamata failureCallback() controllare da dove viene l’errore getCurrentPosition() o successCallback()
  • 44. Esercitazione Utilizzare Guida* di Riferimento del Framework e Javascript 1. Implementare le Funzioni Specifiche 2. Implementare la Logica della Dinamica * versione online e/o formato elettronico
  • 45. PROSSIMA LEZIONE LEGGERE Ottimizzazione WebApp Offline WebApp Mobile SEO