Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
UI Appearance Customizing in iOS 5
Search
Karl Bode
December 01, 2011
Technology
1
780
UI Appearance Customizing in iOS 5
Mein Beitrag zur iPhone Developer Conference 2011 in Köln.
Karl Bode
December 01, 2011
Tweet
Share
More Decks by Karl Bode
See All by Karl Bode
Xcode in der Praxis
kpbode
0
180
Core Data - App-Design, Nested ManagedObjectContexts, Migration
kpbode
0
220
Other Decks in Technology
See All in Technology
セキュアな認可付きリモートMCPサーバーをAWSマネージドサービスでつくろう! / Let's build an OAuth protected remote MCP server based on AWS managed services
kaminashi
3
340
データ戦略部門 紹介資料
sansan33
PRO
1
3.8k
プロダクトのコードから見るGoによるデザインパターンの実践 #go_night_talk
bengo4com
1
2.6k
OCI Network Firewall 概要
oracle4engineer
PRO
2
7.9k
そのWAFのブロック、どう活かす? サービスを守るための実践的多層防御と思考法 / WAF blocks defense decision
kaminashi
0
200
Contract One Engineering Unit 紹介資料
sansan33
PRO
0
8.8k
「使い方教えて」「事例教えて」じゃもう遅い! Microsoft 365 Copilot を触り倒そう!
taichinakamura
0
400
PHPからはじめるコンピュータアーキテクチャ / From Scripts to Silicon: A Journey Through the Layers of Computing Hiroshima 2025 Edition
tomzoh
0
140
いまからでも遅くない!SSL/TLS証明書超入門(It's not too late to start! SSL/TLS Certificates: The Absolute Beginner's Guide)
norimuraz
0
260
20251010_HCCJP_AdaptiveCloudUpdates
sdosamut
0
140
dbtとBigQuery MLで実現する リクルートの営業支援基盤のモデル開発と保守運用
recruitengineers
PRO
3
100
Geospatialの世界最前線を探る [2025年版]
dayjournal
1
230
Featured
See All Featured
Six Lessons from altMBA
skipperchong
29
4k
Fantastic passwords and where to find them - at NoRuKo
philnash
52
3.4k
Context Engineering - Making Every Token Count
addyosmani
7
260
Cheating the UX When There Is Nothing More to Optimize - PixelPioneers
stephaniewalter
285
14k
Bootstrapping a Software Product
garrettdimon
PRO
307
110k
Easily Structure & Communicate Ideas using Wireframe
afnizarnur
194
16k
Java REST API Framework Comparison - PWX 2021
mraible
34
8.9k
Learning to Love Humans: Emotional Interface Design
aarron
274
41k
Leading Effective Engineering Teams in the AI Era
addyosmani
7
450
The Invisible Side of Design
smashingmag
302
51k
How to train your dragon (web standard)
notwaldorf
97
6.3k
YesSQL, Process and Tooling at Scale
rocio
173
14k
Transcript
UI Customization API Karl Bode @karl_in Neu in iOS 5...
hot coffee apps
• Neue Styling-Properties • UIAppearance • UIAppearanceContainer • Code-Beispiele Übersicht
Karl Bode iOS 5 - UI Customization API
• Neue Styling-Properties • UIAppearance • UIAppearanceContainer • Code-Beispiele Übersicht
Karl Bode iOS 5 - UI Customization API
• Neue Styling-Properties • UIAppearance • UIAppearanceContainer • Code-Beispiele Übersicht
Karl Bode iOS 5 - UI Customization API
TintColor • UIActivityIndicatorView • UIProgressView • UISlider • UISwitch •
UISegmentedControl • UI***Bar • UIBarButtonItem Karl Bode iOS 5 - UI Customization API
Image • UIBarButtonItem • UINavigationBar • UISearchBar • UITabBar •
UIToolbar • UIProgressView • UISegmentedControl Karl Bode iOS 5 - UI Customization API
TextAttributes • UIBarItem • UINavigationBar • UISearchBar • UISegmentedControl Karl
Bode iOS 5 - UI Customization API [NSDictionary dictionaryWithObjectsAndKeys: [UIColor whiteColor], UITextAttributeTextColor, nil]];
PositionAdjustment • UIBarButtonItem • UINavigationBar • UISearchBar • UISegmentedControl Karl
Bode iOS 5 - UI Customization API
Proxy-Mechanismus [UISwitch appearance]
• UIAppearance Protokoll • Klassenmethode: appearance • iOS-Runtime liefert Proxy-Instanz
• Styling wird “aufgezeichnet” • Styling wird vor [UIView layoutSubviews] “abgespielt” Proxy-Mechanismus Karl Bode iOS 5 - UI Customization API
• kein Styling in Echtzeit, View muss neu aufgebaut werden
• funktioniert auch mit Subklassen • direktes Styling wird immer bevorzugt Proxy-Mechanismus Karl Bode iOS 5 - UI Customization API
Proxy-Mechanismus ... UISwitch *switchProxy = [UISwitch appearance]; switchProxy.onTintColor = [UIColor
greenColor]; ... Alle Instanzen der Klasse UISwitch anpassen: Karl Bode iOS 5 - UI Customization API
[self showCode]; Karl Bode iOS 5 - UI Customization API
Proxy-Mechanismus ... @interface KBCustomView : UIView<UIAppearance> @property(nonatomic, retain) UIColor* someColor
UI_APPEARANCE_SELECTOR; @end ... Style-Properties werden mit UI_APPEARANCE_SELECTOR markiert: Karl Bode iOS 5 - UI Customization API
[self showCode]; Karl Bode iOS 5 - UI Customization API
Containment • UIAppearanceContainer<NSObject> als Marker-Protokoll • +[id<UIAppearance> whenContainedIn: [Class<UIAppearanceContainer> class],
nil]; • Statement von unten nach oben schreiben Karl Bode iOS 5 - UI Customization API
UIWindow UIView UITabBarViewController UIView KBSecondViewController UIView KBFirstViewController UIView UINavigationController UIView
KBNavigationController UISwitch UISwitch Containment-Hierarchie Karl Bode iOS 5 - UI Customization API
UIWindow UIView UITabBarViewController UIView KBSecondViewController UIView KBFirstViewController UIView UINavigationController UIView
KBNavigationController UISwitch UISwitch Containment-Hierarchie [UISwitch appearance]; Karl Bode iOS 5 - UI Customization API
UIWindow UIView UITabBarViewController UIView KBSecondViewController UIView KBFirstViewController UIView UINavigationController UIView
KBNavigationController UISwitch UISwitch Containment-Hierarchie Karl Bode iOS 5 - UI Customization API
UIWindow UIView UITabBarViewController UIView KBSecondViewController UIView KBFirstViewController UIView UINavigationController UIView
KBNavigationController UISwitch UISwitch Containment-Hierarchie [UISwitch appearanceWhenContainedIn:[KBFirstViewController class], nil]]; Karl Bode iOS 5 - UI Customization API
UIWindow UIView UITabBarViewController UIView KBSecondViewController UIView KBFirstViewController UIView UINavigationController UIView
KBNavigationController UISwitch UISwitch Containment-Hierarchie Karl Bode iOS 5 - UI Customization API
UIWindow UIView UITabBarViewController UIView KBSecondViewController UIView KBFirstViewController UIView UINavigationController UIView
KBNavigationController UISwitch UISwitch Containment-Hierarchie Karl Bode iOS 5 - UI Customization API [UISwitch appearanceWhenContainedIn: [KBSecondViewController class], [KBNavigationController class], nil]];
Containment-Hierarchie • erster eindeutiger Treffer von oben nach unten “gewinnt”
• spezieller vor unspezieller • teilweise müssen z.B. leere Klassen als Marker erstellt werden Karl Bode iOS 5 - UI Customization API
[self showCode]; Karl Bode iOS 5 - UI Customization API
Fazit • neue Properties vereinfachen das Customizing deutlich • reicht
für viele einfache Fälle aus • Containment-Statement könnte ausdrucksstärker sein • Statements unbedingt immer wieder testen! Karl Bode iOS 5 - UI Customization API
Fragen? Karl Bode iOS 5 - UI Customization API @karl_in
[email protected]
Quellen • Customizing the Appearance of UIKit Controls, Chris Parker,
WWDC ’11 • iOS Reference Documentation Karl Bode iOS 5 - UI Customization API