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
170
Core Data - App-Design, Nested ManagedObjectContexts, Migration
kpbode
0
210
Other Decks in Technology
See All in Technology
結局QUICで通信は速くなるの?
kota_yata
8
7.5k
テストを実行してSorbetのsigを書こう!
sansantech
PRO
1
130
プロジェクトマネジメントは不確実性との対話だ
hisashiwatanabe
0
160
Jamf Connect ZTNAとMDMで実現! 金融ベンチャーにおける「デバイストラスト」実例と軌跡 / Kyash Device Trust
rela1470
1
210
AWSの最新サービスでAIエージェント構築に楽しく入門しよう
minorun365
PRO
8
480
Intro to Software Startups: Spring 2025
arnabdotorg
0
280
夏休みWebアプリパフォーマンス相談室/web-app-performance-on-radio
hachi_eiji
1
270
AIと描く、未来のBacklog 〜プロジェクト管理の次の10年を想像し、創造するセッション〜
hrm_o25
0
110
AIが住民向けコンシェルジュに?Amazon Connectと生成AIで実現する自治体AIエージェント!
yuyeah
0
210
✨敗北解法コレクション✨〜Expertだった頃に足りなかった知識と技術〜
nanachi
1
780
ABEMAにおける 生成AI活用の現在地 / The Current Status of Generative AI at ABEMA
dekatotoro
0
370
datadog-distribution-of-opentelemetry-collector-intro
tetsuya28
0
120
Featured
See All Featured
[Rails World 2023 - Day 1 Closing Keynote] - The Magic of Rails
eileencodes
36
2.5k
Six Lessons from altMBA
skipperchong
28
4k
Chrome DevTools: State of the Union 2024 - Debugging React & Beyond
addyosmani
7
810
JavaScript: Past, Present, and Future - NDC Porto 2020
reverentgeek
50
5.5k
The Success of Rails: Ensuring Growth for the Next 100 Years
eileencodes
46
7.6k
How to Create Impact in a Changing Tech Landscape [PerfNow 2023]
tammyeverts
53
2.9k
Raft: Consensus for Rubyists
vanstee
140
7.1k
Building Flexible Design Systems
yeseniaperezcruz
328
39k
Code Review Best Practice
trishagee
69
19k
Faster Mobile Websites
deanohume
309
31k
CoffeeScript is Beautiful & I Never Want to Write Plain JavaScript Again
sstephenson
161
15k
The MySQL Ecosystem @ GitHub 2015
samlambert
251
13k
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