SlideShare une entreprise Scribd logo
1  sur  24
Cliff McCollum
                                 cliffmcc@gmail.com
                                www.leadingsoftware.ca




Universal iOS Applications
Some simple patterns and suggestions
Universal
Application?
Intended Audience
      1. You understand Objective-C
      2. You have created working iOS Apps before
      3. You are familiar with the XCode environment
      4. You have used Interface Builder


If this does not describe you, not to worry. As long as you
have a good understand of C++, Java, or another related
language you should be able to understand the examples.
Basic Steps
1. Configure Project Settings
2. Create Your Classes
3. Test
4. Configure Icons
5. Submit
Key Project Settings

                          Always use latest SDK...
                           ...but target oldest OS




                                  Project settings



 Application .plist file
Key Project Settings



             Weak-link new libraries.
Initial XIB file



              Shared or separate App Delegate?
                        It’s up to you.
Coding Tools
CHECK CLASS SUPPORT

Class
notificationClass
=
NSClassFromString(@"UILocalNotification");

if
(notificationClass)
{


UILocalNotification*
n
=
[[notificationClass
alloc]
init];
}

CHECK METHOD SUPPORT

if
([UIApplication

instancesRespondToSelector:@selector(scheduleLocalNotification:)])
{


[[UIApplication
sharedApplication]
scheduleLocalNotification:n];
}

CHECK DEVICE

if
(UI_USER_INTERFACE_IDIOM()
==
UIUserInterfaceIdiomPad)
{


//
This
is
a
great
new
Macro
in
recent
SDKs
}
Coding Tools
CHECK FOR RETINA DISPLAY

if
([[UIScreen
mainScreen]
respondsToSelector:@selector(scale)]
&&





[[UIScreen
mainScreen]
scale]
==
2.0)
{





//
do
iPhone
4
stuff
}
Common Patterns
1. Common controller, different bundles.
   if
(UI_USER_INTERFACE_IDIOM()
==
UIUserInterfaceIdiomPad)
{
   


self.infoViewController
=
[[InfoViewController
alloc]
          initWithNibName:@"InfoViewController_iPad"
bundle:nil];
   }
   else
{
   


self.infoViewController
=
[[InfoViewController
alloc]

          initWithNibName:@"InfoViewController_iPhone"
bundle:nil];
   }




   iPhone                                                   iPad
2. Common controller, unique presentation.
if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad) {
   // On the iPad, present the view in a popup controller
   self.notesViewController = [[NotesViewController alloc]
                      initWithNibName:@"CardNotes_iPad" bundle:nil];
   CGSize popoverSize;
   popoverSize.width = 600;
   popoverSize.height = 325;
   self.notesViewController.contentSizeForViewInPopover = popoverSize;
   self.notesViewPopoverController = [[UIPopoverController alloc]
          initWithContentViewController:self.notesViewController];
   self.notesViewController.modalInPopover = TRUE;

 CGRect cardTitleRect;
 cardTitleRect.origin.x = 384;
 cardTitleRect.origin.y = 180;
 cardTitleRect.size.width = 1;
 cardTitleRect.size.height = 1;
 [self.notesViewPopoverController presentPopoverFromRect:cardTitleRect
        inView:self.view permittedArrowDirections:UIPopoverArrowDirectionUp animated:TRUE];
}
else {
  // iPhone actions
  self.notesViewController = [[NotesViewController alloc]
                    initWithNibName:@"CardNotes_iPhone" bundle:nil];
  [self presentModalViewController:self.notesViewController animated:TRUE];
}
2. Common controller, unique presentation.
2. Common controller, unique presentation.


-(void)notesViewCleanup {
     if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad)
     {
        [self.notesViewPopoverController dismissPopoverAnimated:TRUE];
        [self.notesViewPopoverController release];
        self.notesViewPopoverController = nil;
     }
     else {
        [self dismissModalViewControllerAnimated:TRUE];
     }
     [self.notesViewController release];
}
3. Common Navigation controller,
-(void)display {

                     unique presentation.
    [self prepareDisplay];

   [self.parentController presentModalViewController:self.navigationController animated:TRUE];
}

-(void)displayInPopup {

   self.usingPopover = TRUE;

   [self prepareDisplay];

   CGSize popoverSize;

   popoverSize.width = 300; popoverSize.height = 365;

   self.navigationController.contentSizeForViewInPopover = popoverSize;

   self.popoverController = [[UIPopoverController alloc]
                                   initWithContentViewController:self.navigationController];

   CGRect solutionTitleRect;

   solutionTitleRect.origin.x = 384; solutionTitleRect.origin.y = 420;

   solutionTitleRect.size.width = 1; solutionTitleRect.size.height = 1;

   [self.popoverController presentPopoverFromRect:solutionTitleRect inView:self.parentController.view

   
      permittedArrowDirections:UIPopoverArrowDirectionUp animated:TRUE];
}

-(void)prepareDisplay {

   self.solutionTableController = [[SolutionSetTableController alloc]

   
      
    
   
    
    
     
    
    initWithNibName:@"SolutionSetTable" bundle:nil];

   self.solutionTableController.title = @"Select An Issue";

   self.solutionTableController.delegate = self;

   UINavigationController *newNav = [[UINavigationController alloc]

   
      
    
   
    
    
     
    
      initWithRootViewController:self.solutionTableController];

   UIBarButtonItem *backButton = [[UIBarButtonItem alloc] initWithTitle:@"Back"
                         style:UIBarButtonItemStylePlain target:self action:@selector(backButtonClicked:)];

   newNav.navigationBar.topItem.leftBarButtonItem = backButton;

   [backButton release];

   self.navigationController = newNav;
}
3. Common Navigation controller,
      unique presentation.
3. Common Navigation controller,
              unique presentation.

-(void)cleanupDisplay {

 if (self.usingPopover) {
      [self.popoverController dismissPopoverAnimated:TRUE];      
  

 }
   else {
      [self.navigationController dismissModalViewControllerAnimated:TRUE];
   }
}
4. UIWebView for unique presentation
@media only screen and (min-device-width: 768px) and (max-device-width: 1024px) {
  /* rules for iPad */
  body {
    font-size: 24px;
  }
  img.LGautosize {
  width: 36px; height: 36px;
  }
  img.SMautosize {
  width: 24px; height: 24px;
  }
}

@media only screen and (min-device-width: 320px) and (max-device-width: 480px) {
  /* iPhone rules here */
  body {
    font-size: 16px;
  }
  img.LGautosize {
  width: 24px; height: 24px;
  }
  img.SMautosize {
  width: 16px; height: 16px;
  }
}
4. UIWebView for unique presentation

<img src="heart.png" class="LGautosize"/>
5. Unique Subclasses
•Use Subclasses instead of conditionals
•Common behavior in parent class
•Use XIB to create proper subclass
•Device specific behavior in subclass
Icon Settings




      Application .plist file
REFERENCES
Apple WWDC 2010 Session Videos: http://developer.apple.com/videos/wwdc/2010/
                                Sessions 103, 301, 303

                 Universal Icons: Apple Technical Q&A QA1686
CREDITS


           Opening image: Icon Factory

Sample Application: Teamwork, by Calliope Learning




                                                          Cliff McCollum
                                                      cliffmcc@gmail.com
                                                     www.leadingsoftware.ca
Questions

Contenu connexe

Dernier

The Future of Software Development - Devin AI Innovative Approach.pdf
The Future of Software Development - Devin AI Innovative Approach.pdfThe Future of Software Development - Devin AI Innovative Approach.pdf
The Future of Software Development - Devin AI Innovative Approach.pdfSeasiaInfotech2
 
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks..."LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...Fwdays
 
Powerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time ClashPowerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time Clashcharlottematthew16
 
Human Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsHuman Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsMark Billinghurst
 
SAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptxSAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptxNavinnSomaal
 
Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 3652toLead Limited
 
"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii SoldatenkoFwdays
 
Developer Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLDeveloper Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLScyllaDB
 
My INSURER PTE LTD - Insurtech Innovation Award 2024
My INSURER PTE LTD - Insurtech Innovation Award 2024My INSURER PTE LTD - Insurtech Innovation Award 2024
My INSURER PTE LTD - Insurtech Innovation Award 2024The Digital Insurer
 
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage CostLeverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage CostZilliz
 
Streamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupStreamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupFlorian Wilhelm
 
Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationBeyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationSafe Software
 
Artificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptxArtificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptxhariprasad279825
 
DevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsDevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsSergiu Bodiu
 
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Mark Simos
 
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek SchlawackFwdays
 
My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationRidwan Fadjar
 
Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!Manik S Magar
 
Vector Databases 101 - An introduction to the world of Vector Databases
Vector Databases 101 - An introduction to the world of Vector DatabasesVector Databases 101 - An introduction to the world of Vector Databases
Vector Databases 101 - An introduction to the world of Vector DatabasesZilliz
 

Dernier (20)

The Future of Software Development - Devin AI Innovative Approach.pdf
The Future of Software Development - Devin AI Innovative Approach.pdfThe Future of Software Development - Devin AI Innovative Approach.pdf
The Future of Software Development - Devin AI Innovative Approach.pdf
 
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks..."LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
 
Powerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time ClashPowerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time Clash
 
Human Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsHuman Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR Systems
 
SAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptxSAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptx
 
Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365
 
"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko
 
Developer Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLDeveloper Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQL
 
My INSURER PTE LTD - Insurtech Innovation Award 2024
My INSURER PTE LTD - Insurtech Innovation Award 2024My INSURER PTE LTD - Insurtech Innovation Award 2024
My INSURER PTE LTD - Insurtech Innovation Award 2024
 
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage CostLeverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
 
Streamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupStreamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project Setup
 
Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationBeyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
 
Artificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptxArtificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptx
 
DevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsDevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platforms
 
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
 
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
 
My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 Presentation
 
Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!
 
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptxE-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
 
Vector Databases 101 - An introduction to the world of Vector Databases
Vector Databases 101 - An introduction to the world of Vector DatabasesVector Databases 101 - An introduction to the world of Vector Databases
Vector Databases 101 - An introduction to the world of Vector Databases
 

En vedette

PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024Neil Kimberley
 
Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)contently
 
How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024Albert Qian
 
Social Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsSocial Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsKurio // The Social Media Age(ncy)
 
Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024Search Engine Journal
 
5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summarySpeakerHub
 
ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd Clark Boyd
 
Getting into the tech field. what next
Getting into the tech field. what next Getting into the tech field. what next
Getting into the tech field. what next Tessa Mero
 
Google's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search IntentGoogle's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search IntentLily Ray
 
Time Management & Productivity - Best Practices
Time Management & Productivity -  Best PracticesTime Management & Productivity -  Best Practices
Time Management & Productivity - Best PracticesVit Horky
 
The six step guide to practical project management
The six step guide to practical project managementThe six step guide to practical project management
The six step guide to practical project managementMindGenius
 
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...RachelPearson36
 
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...Applitools
 
12 Ways to Increase Your Influence at Work
12 Ways to Increase Your Influence at Work12 Ways to Increase Your Influence at Work
12 Ways to Increase Your Influence at WorkGetSmarter
 
Ride the Storm: Navigating Through Unstable Periods / Katerina Rudko (Belka G...
Ride the Storm: Navigating Through Unstable Periods / Katerina Rudko (Belka G...Ride the Storm: Navigating Through Unstable Periods / Katerina Rudko (Belka G...
Ride the Storm: Navigating Through Unstable Periods / Katerina Rudko (Belka G...DevGAMM Conference
 
Barbie - Brand Strategy Presentation
Barbie - Brand Strategy PresentationBarbie - Brand Strategy Presentation
Barbie - Brand Strategy PresentationErica Santiago
 

En vedette (20)

PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024
 
Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)
 
How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024
 
Social Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsSocial Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie Insights
 
Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024
 
5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary
 
ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd
 
Getting into the tech field. what next
Getting into the tech field. what next Getting into the tech field. what next
Getting into the tech field. what next
 
Google's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search IntentGoogle's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search Intent
 
How to have difficult conversations
How to have difficult conversations How to have difficult conversations
How to have difficult conversations
 
Introduction to Data Science
Introduction to Data ScienceIntroduction to Data Science
Introduction to Data Science
 
Time Management & Productivity - Best Practices
Time Management & Productivity -  Best PracticesTime Management & Productivity -  Best Practices
Time Management & Productivity - Best Practices
 
The six step guide to practical project management
The six step guide to practical project managementThe six step guide to practical project management
The six step guide to practical project management
 
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
 
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
 
12 Ways to Increase Your Influence at Work
12 Ways to Increase Your Influence at Work12 Ways to Increase Your Influence at Work
12 Ways to Increase Your Influence at Work
 
ChatGPT webinar slides
ChatGPT webinar slidesChatGPT webinar slides
ChatGPT webinar slides
 
More than Just Lines on a Map: Best Practices for U.S Bike Routes
More than Just Lines on a Map: Best Practices for U.S Bike RoutesMore than Just Lines on a Map: Best Practices for U.S Bike Routes
More than Just Lines on a Map: Best Practices for U.S Bike Routes
 
Ride the Storm: Navigating Through Unstable Periods / Katerina Rudko (Belka G...
Ride the Storm: Navigating Through Unstable Periods / Katerina Rudko (Belka G...Ride the Storm: Navigating Through Unstable Periods / Katerina Rudko (Belka G...
Ride the Storm: Navigating Through Unstable Periods / Katerina Rudko (Belka G...
 
Barbie - Brand Strategy Presentation
Barbie - Brand Strategy PresentationBarbie - Brand Strategy Presentation
Barbie - Brand Strategy Presentation
 

Creating a Universal iOS Application

  • 1. Cliff McCollum cliffmcc@gmail.com www.leadingsoftware.ca Universal iOS Applications Some simple patterns and suggestions
  • 3. Intended Audience 1. You understand Objective-C 2. You have created working iOS Apps before 3. You are familiar with the XCode environment 4. You have used Interface Builder If this does not describe you, not to worry. As long as you have a good understand of C++, Java, or another related language you should be able to understand the examples.
  • 4. Basic Steps 1. Configure Project Settings 2. Create Your Classes 3. Test 4. Configure Icons 5. Submit
  • 5. Key Project Settings Always use latest SDK... ...but target oldest OS Project settings Application .plist file
  • 6. Key Project Settings Weak-link new libraries.
  • 7. Initial XIB file Shared or separate App Delegate? It’s up to you.
  • 8. Coding Tools CHECK CLASS SUPPORT Class
notificationClass
=
NSClassFromString(@"UILocalNotification");
 if
(notificationClass)
{ 

UILocalNotification*
n
=
[[notificationClass
alloc]
init]; } CHECK METHOD SUPPORT if
([UIApplication
 instancesRespondToSelector:@selector(scheduleLocalNotification:)])
{ 

[[UIApplication
sharedApplication]
scheduleLocalNotification:n]; } CHECK DEVICE if
(UI_USER_INTERFACE_IDIOM()
==
UIUserInterfaceIdiomPad)
{ 

//
This
is
a
great
new
Macro
in
recent
SDKs }
  • 9. Coding Tools CHECK FOR RETINA DISPLAY if
([[UIScreen
mainScreen]
respondsToSelector:@selector(scale)]
&& 




[[UIScreen
mainScreen]
scale]
==
2.0)
{ 




//
do
iPhone
4
stuff }
  • 11. 1. Common controller, different bundles. if
(UI_USER_INTERFACE_IDIOM()
==
UIUserInterfaceIdiomPad)
{ 


self.infoViewController
=
[[InfoViewController
alloc] initWithNibName:@"InfoViewController_iPad"
bundle:nil]; } else
{ 


self.infoViewController
=
[[InfoViewController
alloc]
 initWithNibName:@"InfoViewController_iPhone"
bundle:nil]; } iPhone iPad
  • 12. 2. Common controller, unique presentation. if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad) { // On the iPad, present the view in a popup controller self.notesViewController = [[NotesViewController alloc] initWithNibName:@"CardNotes_iPad" bundle:nil]; CGSize popoverSize; popoverSize.width = 600; popoverSize.height = 325; self.notesViewController.contentSizeForViewInPopover = popoverSize; self.notesViewPopoverController = [[UIPopoverController alloc] initWithContentViewController:self.notesViewController]; self.notesViewController.modalInPopover = TRUE; CGRect cardTitleRect; cardTitleRect.origin.x = 384; cardTitleRect.origin.y = 180; cardTitleRect.size.width = 1; cardTitleRect.size.height = 1; [self.notesViewPopoverController presentPopoverFromRect:cardTitleRect inView:self.view permittedArrowDirections:UIPopoverArrowDirectionUp animated:TRUE]; } else { // iPhone actions self.notesViewController = [[NotesViewController alloc] initWithNibName:@"CardNotes_iPhone" bundle:nil]; [self presentModalViewController:self.notesViewController animated:TRUE]; }
  • 13. 2. Common controller, unique presentation.
  • 14. 2. Common controller, unique presentation. -(void)notesViewCleanup { if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad) { [self.notesViewPopoverController dismissPopoverAnimated:TRUE]; [self.notesViewPopoverController release]; self.notesViewPopoverController = nil; } else { [self dismissModalViewControllerAnimated:TRUE]; } [self.notesViewController release]; }
  • 15. 3. Common Navigation controller, -(void)display { unique presentation. [self prepareDisplay]; [self.parentController presentModalViewController:self.navigationController animated:TRUE]; } -(void)displayInPopup { self.usingPopover = TRUE; [self prepareDisplay]; CGSize popoverSize; popoverSize.width = 300; popoverSize.height = 365; self.navigationController.contentSizeForViewInPopover = popoverSize; self.popoverController = [[UIPopoverController alloc] initWithContentViewController:self.navigationController]; CGRect solutionTitleRect; solutionTitleRect.origin.x = 384; solutionTitleRect.origin.y = 420; solutionTitleRect.size.width = 1; solutionTitleRect.size.height = 1; [self.popoverController presentPopoverFromRect:solutionTitleRect inView:self.parentController.view permittedArrowDirections:UIPopoverArrowDirectionUp animated:TRUE]; } -(void)prepareDisplay { self.solutionTableController = [[SolutionSetTableController alloc] initWithNibName:@"SolutionSetTable" bundle:nil]; self.solutionTableController.title = @"Select An Issue"; self.solutionTableController.delegate = self; UINavigationController *newNav = [[UINavigationController alloc] initWithRootViewController:self.solutionTableController]; UIBarButtonItem *backButton = [[UIBarButtonItem alloc] initWithTitle:@"Back" style:UIBarButtonItemStylePlain target:self action:@selector(backButtonClicked:)]; newNav.navigationBar.topItem.leftBarButtonItem = backButton; [backButton release]; self.navigationController = newNav; }
  • 16. 3. Common Navigation controller, unique presentation.
  • 17. 3. Common Navigation controller, unique presentation. -(void)cleanupDisplay { if (self.usingPopover) { [self.popoverController dismissPopoverAnimated:TRUE]; } else { [self.navigationController dismissModalViewControllerAnimated:TRUE]; } }
  • 18. 4. UIWebView for unique presentation @media only screen and (min-device-width: 768px) and (max-device-width: 1024px) { /* rules for iPad */ body { font-size: 24px; } img.LGautosize { width: 36px; height: 36px; } img.SMautosize { width: 24px; height: 24px; } } @media only screen and (min-device-width: 320px) and (max-device-width: 480px) { /* iPhone rules here */ body { font-size: 16px; } img.LGautosize { width: 24px; height: 24px; } img.SMautosize { width: 16px; height: 16px; } }
  • 19. 4. UIWebView for unique presentation <img src="heart.png" class="LGautosize"/>
  • 20. 5. Unique Subclasses •Use Subclasses instead of conditionals •Common behavior in parent class •Use XIB to create proper subclass •Device specific behavior in subclass
  • 21. Icon Settings Application .plist file
  • 22. REFERENCES Apple WWDC 2010 Session Videos: http://developer.apple.com/videos/wwdc/2010/ Sessions 103, 301, 303 Universal Icons: Apple Technical Q&A QA1686
  • 23. CREDITS Opening image: Icon Factory Sample Application: Teamwork, by Calliope Learning Cliff McCollum cliffmcc@gmail.com www.leadingsoftware.ca

Notes de l'éditeur

  1. What is a Universal Application? An app that includes both iPhone and iPad versions inside a single binary.
  2. As you write your universal apps, you&amp;#x2019;ll find yourself wanting to ask a few common questions...
  3. Check if a class exists Check if a class supports a new method Check if you are on an iPad