SlideShare uma empresa Scribd logo
1 de 16
What's On For Today?

1.Theming Applications
2.Introducing UIAppearance
3.Example
How do you "theme" your
application with color, style?
Common UI Customizations

– UINavigationBar tint color, title image

– UIToolbar tint color

– UIBarButtonItem tint color, style

– UIButton, UILabel, etc.
Pre-iOS5, How Did We Customize?

– viewWillAppear:

– Subclassing UIKit classes' drawRect:
  method

– NSNotificationCenter
Pre-iOS5, How Did We Customize?

-(void)viewWillAppear:(BOOL)animated:
{
  [super viewWillAppear:animated];

    // What is our current theme?
    NSUserDefaults *settings = [NSUserDefaults standardUserDefaults];
    NSString *theme = [settings objectForKey:@"theme"];


    // Set up color based on theme
    if ([theme isEqualToString:@"red"]) {
      self.navBar.tintColor = [UIColor redColor];
    }
    else {
      self.navBar.tintColor = [UIColor blueColor];
    }
}
The Problem With All Of This

• Every view controller needs to "know"
  about how to handle themes/styles

• Lots of copy & pasted code, annoying
  to maintain or add themes



              Swinburne University of Technology
What's On For Today?

1. Theming Applications
2. Introducing UIAppearance
3. Example
Without UIAppearance


                      setTintColor:
   UIViewController                   UINavigationBar

                      setTintColor:
   UIViewController                   UINavigationBar

                      setTintColor:
   UIViewController                   UINavigationBar
With UIAppearance, 1

            ThemeManager
   setTintColor:
                           setTintColor:
                                           UINavigationBar


        UIAppearance Proxy                 UINavigationBar


                                           UINavigationBar
With UIAppearance, 2


                UIViewController
   alloc/init



                                   -tintColor:
                UINavigationBar                  UIAppearance Proxy
Current UIAppearance classes
–   UIActivityIndicatorView
–   UIBarButtonItem
–   UIBarItem
–   UINavigationBar
–   UIProgressView
–   UISearchBar
–   UISegmentedControl
–   UISlider
–   UISwitch
–   UITabBar
–   UITabBarItem
–   UIToolbar
Source: http://stackoverflow.com/questions/9424112/what-properties-can-i-set-via-an-
uiappearance-proxy
More details…

• Unfortunately, Apple hasn't documented this
  feature well yet.

• Unfortunately, not all UIView subclasses work
  yet
• Search for UI_APPEARANCE_SELECTOR in
  Spotlight
• Full reverse-engineered list here:
  http://www.raywenderlich.com/4344/user-interface-customization-in-ios-5
Who is missing?

• UITableViewCell
• UITextField
• UILabel
What's On For Today?

1.Theming Applications
2.Introducing UIAppearance
3.Example
THANK YOU

Questions?

Mais conteúdo relacionado

Semelhante a April iOS Meetup - UIAppearance Presentation

Session 13 - Working with navigation and tab bar
Session 13 - Working with navigation and tab barSession 13 - Working with navigation and tab bar
Session 13 - Working with navigation and tab barVu Tran Lam
 
Intro to UIKit • Made by Many
Intro to UIKit • Made by ManyIntro to UIKit • Made by Many
Intro to UIKit • Made by Manykenatmxm
 
Leaving Interface Builder Behind
Leaving Interface Builder BehindLeaving Interface Builder Behind
Leaving Interface Builder BehindJohn Wilker
 
Android Support Library: Using ActionBarCompat
Android Support Library: Using ActionBarCompatAndroid Support Library: Using ActionBarCompat
Android Support Library: Using ActionBarCompatcbeyls
 
iOS Development: What's New
iOS Development: What's NewiOS Development: What's New
iOS Development: What's NewNascentDigital
 
Introduction to java beans
Introduction to java beansIntroduction to java beans
Introduction to java beansHitesh Parmar
 
Developing for Apple TV
Developing for Apple TVDeveloping for Apple TV
Developing for Apple TValekseyn
 
iOS Programming 101
iOS Programming 101iOS Programming 101
iOS Programming 101rwenderlich
 
漫游iOS开发指南
漫游iOS开发指南漫游iOS开发指南
漫游iOS开发指南jeff kit
 
Cross platform mobile development
Cross platform mobile development Cross platform mobile development
Cross platform mobile development Alberto De Bortoli
 
iPhone Development: Multiple Views
iPhone Development: Multiple ViewsiPhone Development: Multiple Views
iPhone Development: Multiple ViewsJussi Pohjolainen
 
Android and IOS UI Development (Android 5.0 and iOS 9.0)
Android and IOS UI Development (Android 5.0 and iOS 9.0)Android and IOS UI Development (Android 5.0 and iOS 9.0)
Android and IOS UI Development (Android 5.0 and iOS 9.0)Michael Shrove
 
iPhone Programming in 30 minutes (?) [FTS]
iPhone Programming in 30 minutes (?) [FTS]iPhone Programming in 30 minutes (?) [FTS]
iPhone Programming in 30 minutes (?) [FTS]Diego Pizzocaro
 

Semelhante a April iOS Meetup - UIAppearance Presentation (20)

iOS: View Controllers
iOS: View ControllersiOS: View Controllers
iOS: View Controllers
 
занятие6
занятие6занятие6
занятие6
 
Session 13 - Working with navigation and tab bar
Session 13 - Working with navigation and tab barSession 13 - Working with navigation and tab bar
Session 13 - Working with navigation and tab bar
 
Intro to UIKit • Made by Many
Intro to UIKit • Made by ManyIntro to UIKit • Made by Many
Intro to UIKit • Made by Many
 
Introduction of Xcode
Introduction of XcodeIntroduction of Xcode
Introduction of Xcode
 
Leaving Interface Builder Behind
Leaving Interface Builder BehindLeaving Interface Builder Behind
Leaving Interface Builder Behind
 
Android Support Library: Using ActionBarCompat
Android Support Library: Using ActionBarCompatAndroid Support Library: Using ActionBarCompat
Android Support Library: Using ActionBarCompat
 
iOS Development: What's New
iOS Development: What's NewiOS Development: What's New
iOS Development: What's New
 
Introduction to java beans
Introduction to java beansIntroduction to java beans
Introduction to java beans
 
Developing for Apple TV
Developing for Apple TVDeveloping for Apple TV
Developing for Apple TV
 
iOS Programming 101
iOS Programming 101iOS Programming 101
iOS Programming 101
 
漫游iOS开发指南
漫游iOS开发指南漫游iOS开发指南
漫游iOS开发指南
 
Android ui part 2
Android ui part 2Android ui part 2
Android ui part 2
 
Cross platform mobile development
Cross platform mobile development Cross platform mobile development
Cross platform mobile development
 
iPhone Development: Multiple Views
iPhone Development: Multiple ViewsiPhone Development: Multiple Views
iPhone Development: Multiple Views
 
Android and IOS UI Development (Android 5.0 and iOS 9.0)
Android and IOS UI Development (Android 5.0 and iOS 9.0)Android and IOS UI Development (Android 5.0 and iOS 9.0)
Android and IOS UI Development (Android 5.0 and iOS 9.0)
 
I os 11
I os 11I os 11
I os 11
 
iPhone Programming in 30 minutes (?) [FTS]
iPhone Programming in 30 minutes (?) [FTS]iPhone Programming in 30 minutes (?) [FTS]
iPhone Programming in 30 minutes (?) [FTS]
 
IOS Storyboards
IOS StoryboardsIOS Storyboards
IOS Storyboards
 
Java beans
Java beansJava beans
Java beans
 

Último

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...Martijn de Jong
 
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodPolkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodJuan lago vázquez
 
[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdf[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdfSandro Moreira
 
ICT role in 21st century education and its challenges
ICT role in 21st century education and its challengesICT role in 21st century education and its challenges
ICT role in 21st century education and its challengesrafiqahmad00786416
 
Cyberprint. Dark Pink Apt Group [EN].pdf
Cyberprint. Dark Pink Apt Group [EN].pdfCyberprint. Dark Pink Apt Group [EN].pdf
Cyberprint. Dark Pink Apt Group [EN].pdfOverkill Security
 
Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native ApplicationsWSO2
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FMESafe Software
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century educationjfdjdjcjdnsjd
 
Corporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptxCorporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptxRustici Software
 
Manulife - Insurer Transformation Award 2024
Manulife - Insurer Transformation Award 2024Manulife - Insurer Transformation Award 2024
Manulife - Insurer Transformation Award 2024The Digital Insurer
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfsudhanshuwaghmare1
 
AXA XL - Insurer Innovation Award Americas 2024
AXA XL - Insurer Innovation Award Americas 2024AXA XL - Insurer Innovation Award Americas 2024
AXA XL - Insurer Innovation Award Americas 2024The Digital Insurer
 
Artificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyArtificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyKhushali Kathiriya
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FMESafe Software
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAndrey Devyatkin
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProduct Anonymous
 
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...apidays
 
CNIC Information System with Pakdata Cf In Pakistan
CNIC Information System with Pakdata Cf In PakistanCNIC Information System with Pakdata Cf In Pakistan
CNIC Information System with Pakdata Cf In Pakistandanishmna97
 
Spring Boot vs Quarkus the ultimate battle - DevoxxUK
Spring Boot vs Quarkus the ultimate battle - DevoxxUKSpring Boot vs Quarkus the ultimate battle - DevoxxUK
Spring Boot vs Quarkus the ultimate battle - DevoxxUKJago de Vreede
 

Último (20)

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...
 
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodPolkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
 
[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdf[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdf
 
ICT role in 21st century education and its challenges
ICT role in 21st century education and its challengesICT role in 21st century education and its challenges
ICT role in 21st century education and its challenges
 
Cyberprint. Dark Pink Apt Group [EN].pdf
Cyberprint. Dark Pink Apt Group [EN].pdfCyberprint. Dark Pink Apt Group [EN].pdf
Cyberprint. Dark Pink Apt Group [EN].pdf
 
Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native Applications
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century education
 
Corporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptxCorporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptx
 
Manulife - Insurer Transformation Award 2024
Manulife - Insurer Transformation Award 2024Manulife - Insurer Transformation Award 2024
Manulife - Insurer Transformation Award 2024
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
AXA XL - Insurer Innovation Award Americas 2024
AXA XL - Insurer Innovation Award Americas 2024AXA XL - Insurer Innovation Award Americas 2024
AXA XL - Insurer Innovation Award Americas 2024
 
Artificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyArtificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : Uncertainty
 
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of Terraform
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
 
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
 
CNIC Information System with Pakdata Cf In Pakistan
CNIC Information System with Pakdata Cf In PakistanCNIC Information System with Pakdata Cf In Pakistan
CNIC Information System with Pakdata Cf In Pakistan
 
Spring Boot vs Quarkus the ultimate battle - DevoxxUK
Spring Boot vs Quarkus the ultimate battle - DevoxxUKSpring Boot vs Quarkus the ultimate battle - DevoxxUK
Spring Boot vs Quarkus the ultimate battle - DevoxxUK
 

April iOS Meetup - UIAppearance Presentation

  • 1. What's On For Today? 1.Theming Applications 2.Introducing UIAppearance 3.Example
  • 2. How do you "theme" your application with color, style?
  • 3.
  • 4. Common UI Customizations – UINavigationBar tint color, title image – UIToolbar tint color – UIBarButtonItem tint color, style – UIButton, UILabel, etc.
  • 5. Pre-iOS5, How Did We Customize? – viewWillAppear: – Subclassing UIKit classes' drawRect: method – NSNotificationCenter
  • 6. Pre-iOS5, How Did We Customize? -(void)viewWillAppear:(BOOL)animated: { [super viewWillAppear:animated]; // What is our current theme? NSUserDefaults *settings = [NSUserDefaults standardUserDefaults]; NSString *theme = [settings objectForKey:@"theme"]; // Set up color based on theme if ([theme isEqualToString:@"red"]) { self.navBar.tintColor = [UIColor redColor]; } else { self.navBar.tintColor = [UIColor blueColor]; } }
  • 7. The Problem With All Of This • Every view controller needs to "know" about how to handle themes/styles • Lots of copy & pasted code, annoying to maintain or add themes Swinburne University of Technology
  • 8. What's On For Today? 1. Theming Applications 2. Introducing UIAppearance 3. Example
  • 9. Without UIAppearance setTintColor: UIViewController UINavigationBar setTintColor: UIViewController UINavigationBar setTintColor: UIViewController UINavigationBar
  • 10. With UIAppearance, 1 ThemeManager setTintColor: setTintColor: UINavigationBar UIAppearance Proxy UINavigationBar UINavigationBar
  • 11. With UIAppearance, 2 UIViewController alloc/init -tintColor: UINavigationBar UIAppearance Proxy
  • 12. Current UIAppearance classes – UIActivityIndicatorView – UIBarButtonItem – UIBarItem – UINavigationBar – UIProgressView – UISearchBar – UISegmentedControl – UISlider – UISwitch – UITabBar – UITabBarItem – UIToolbar Source: http://stackoverflow.com/questions/9424112/what-properties-can-i-set-via-an- uiappearance-proxy
  • 13. More details… • Unfortunately, Apple hasn't documented this feature well yet. • Unfortunately, not all UIView subclasses work yet • Search for UI_APPEARANCE_SELECTOR in Spotlight • Full reverse-engineered list here: http://www.raywenderlich.com/4344/user-interface-customization-in-ios-5
  • 14. Who is missing? • UITableViewCell • UITextField • UILabel
  • 15. What's On For Today? 1.Theming Applications 2.Introducing UIAppearance 3.Example