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

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
 
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
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)wesley chun
 
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEarley Information Science
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Miguel Araújo
 
Evaluating the top large language models.pdf
Evaluating the top large language models.pdfEvaluating the top large language models.pdf
Evaluating the top large language models.pdfChristopherTHyatt
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024The Digital Insurer
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsJoaquim Jorge
 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfEnterprise Knowledge
 
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 slidevu2urc
 
Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024The Digital Insurer
 
Tech Trends Report 2024 Future Today Institute.pdf
Tech Trends Report 2024 Future Today Institute.pdfTech Trends Report 2024 Future Today Institute.pdf
Tech Trends Report 2024 Future Today Institute.pdfhans926745
 
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...Enterprise Knowledge
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreternaman860154
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationMichael W. Hawkins
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024The Digital Insurer
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processorsdebabhi2
 
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 organizationRadu Cotescu
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Servicegiselly40
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...apidays
 

Último (20)

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
 
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
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)
 
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
 
Evaluating the top large language models.pdf
Evaluating the top large language models.pdfEvaluating the top large language models.pdf
Evaluating the top large language models.pdf
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
 
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
 
Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024
 
Tech Trends Report 2024 Future Today Institute.pdf
Tech Trends Report 2024 Future Today Institute.pdfTech Trends Report 2024 Future Today Institute.pdf
Tech Trends Report 2024 Future Today Institute.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...
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreter
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day Presentation
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 
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
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Service
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
 

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