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
770
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
160
Core Data - App-Design, Nested ManagedObjectContexts, Migration
kpbode
0
200
Other Decks in Technology
See All in Technology
Windows 11 で AWS Documentation MCP Server 接続実践/practical-aws-documentation-mcp-server-connection-on-windows-11
emiki
0
700
Azure AI Foundryでマルチエージェントワークフロー
seosoft
0
150
実践! AIエージェント導入記
1mono2prod
0
140
CIでのgolangci-lintの実行を約90%削減した話
kazukihayase
0
340
ハノーバーメッセ2025座談会.pdf
iotcomjpadmin
0
150
Oracle Cloud Infrastructure:2025年6月度サービス・アップデート
oracle4engineer
PRO
1
140
BigQuery Remote FunctionでLooker Studioをインタラクティブ化
cuebic9bic
2
230
20250623 Findy Lunch LT Brown
3150
0
770
本当に使える?AutoUpgrade の新機能を実践検証してみた
oracle4engineer
PRO
1
120
OAuth/OpenID Connectで実現するMCPのセキュアなアクセス管理
kuralab
5
850
DenoとJSRで実現する最速MCPサーバー開発記 / Building MCP Servers at Lightning Speed with Deno and JSR
yamanoku
1
280
TechLION vol.41~MySQLユーザ会のほうから来ました / techlion41_mysql
sakaik
0
150
Featured
See All Featured
Git: the NoSQL Database
bkeepers
PRO
430
65k
Product Roadmaps are Hard
iamctodd
PRO
53
11k
Docker and Python
trallard
44
3.4k
The Invisible Side of Design
smashingmag
299
51k
RailsConf & Balkan Ruby 2019: The Past, Present, and Future of Rails at GitHub
eileencodes
137
34k
Practical Tips for Bootstrapping Information Extraction Pipelines
honnibal
PRO
20
1.3k
Building Flexible Design Systems
yeseniaperezcruz
328
39k
The Art of Delivering Value - GDevCon NA Keynote
reverentgeek
15
1.5k
Visualizing Your Data: Incorporating Mongo into Loggly Infrastructure
mongodb
46
9.6k
Performance Is Good for Brains [We Love Speed 2024]
tammyeverts
10
920
Refactoring Trust on Your Teams (GOTO; Chicago 2020)
rmw
34
3k
Let's Do A Bunch of Simple Stuff to Make Websites Faster
chriscoyier
507
140k
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