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
170
Core Data - App-Design, Nested ManagedObjectContexts, Migration
kpbode
0
210
Other Decks in Technology
See All in Technology
AIエージェントで90秒の広告動画を制作!台本・音声・映像・編集をつなぐAWS最新アーキテクチャの実践
nasuvitz
3
310
Agile PBL at New Grads Trainings
kawaguti
PRO
1
440
5年目から始める Vue3 サイト改善 #frontendo
tacck
PRO
3
230
AWSを利用する上で知っておきたい名前解決のはなし(10分版)
nagisa53
10
3.2k
ハードウェアとソフトウェアをつなぐ全てを内製している企業の E2E テストの作り方 / How to create E2E tests for a company that builds everything connecting hardware and software in-house
bitkey
PRO
1
160
2025年夏 コーディングエージェントを統べる者
nwiizo
0
180
Firestore → Spanner 移行 を成功させた段階的移行プロセス
athug
1
490
Autonomous Database - Dedicated 技術詳細 / adb-d_technical_detail_jp
oracle4engineer
PRO
4
10k
プラットフォーム転換期におけるGitHub Copilot活用〜Coding agentがそれを加速するか〜 / Leveraging GitHub Copilot During Platform Transition Periods
aeonpeople
1
210
株式会社ログラス - 会社説明資料【エンジニア】/ Loglass Engineer
loglass2019
4
65k
Rustから学ぶ 非同期処理の仕組み
skanehira
1
150
2つのフロントエンドと状態管理
mixi_engineers
PRO
3
110
Featured
See All Featured
No one is an island. Learnings from fostering a developers community.
thoeni
21
3.4k
Context Engineering - Making Every Token Count
addyosmani
3
55
Making the Leap to Tech Lead
cromwellryan
135
9.5k
Cheating the UX When There Is Nothing More to Optimize - PixelPioneers
stephaniewalter
285
13k
Scaling GitHub
holman
463
140k
Embracing the Ebb and Flow
colly
87
4.8k
Building Adaptive Systems
keathley
43
2.7k
ReactJS: Keep Simple. Everything can be a component!
pedronauck
667
120k
The Invisible Side of Design
smashingmag
301
51k
It's Worth the Effort
3n
187
28k
Exploring the Power of Turbo Streams & Action Cable | RailsConf2023
kevinliebholz
34
6k
JavaScript: Past, Present, and Future - NDC Porto 2020
reverentgeek
52
5.6k
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