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
UISS
Search
Robert Wijas
November 14, 2013
Programming
0
110
UISS
Talk about my UISS library presented at Mobile Warsaw and CocoaHeads Cracow.
Robert Wijas
November 14, 2013
Tweet
Share
More Decks by Robert Wijas
See All by Robert Wijas
UISS Blitz Talk
robertwijas
0
120
The Lean Startup
robertwijas
0
150
Pomodoro Blitz Talk
robertwijas
2
160
Pomodoro
robertwijas
0
110
Other Decks in Programming
See All in Programming
Realtime API 入門
riofujimon
0
150
as(型アサーション)を書く前にできること
marokanatani
10
2.6k
役立つログに取り組もう
irof
28
9.6k
エンジニアとして関わる要件と仕様(公開用)
murabayashi
0
290
Jakarta EE meets AI
ivargrimstad
0
150
PHP でアセンブリ言語のように書く技術
memory1994
PRO
1
170
シェーダーで魅せるMapLibreの動的ラスタータイル
satoshi7190
1
480
watsonx.ai Dojo #4 生成AIを使ったアプリ開発、応用編
oniak3ibm
PRO
1
100
リアーキテクチャxDDD 1年間の取り組みと進化
hsawaji
1
220
Jakarta EE meets AI
ivargrimstad
0
540
弊社の「意識チョット低いアーキテクチャ」10選
texmeijin
5
24k
3 Effective Rules for Using Signals in Angular
manfredsteyer
PRO
0
110
Featured
See All Featured
The Power of CSS Pseudo Elements
geoffreycrofte
73
5.3k
Practical Tips for Bootstrapping Information Extraction Pipelines
honnibal
PRO
10
720
Imperfection Machines: The Place of Print at Facebook
scottboms
265
13k
Ruby is Unlike a Banana
tanoku
97
11k
Stop Working from a Prison Cell
hatefulcrawdad
267
20k
What’s in a name? Adding method to the madness
productmarketing
PRO
22
3.1k
Designing Dashboards & Data Visualisations in Web Apps
destraynor
229
52k
Side Projects
sachag
452
42k
Intergalactic Javascript Robots from Outer Space
tanoku
269
27k
Mobile First: as difficult as doing things right
swwweet
222
8.9k
Build your cross-platform service in a week with App Engine
jlugia
229
18k
Code Reviewing Like a Champion
maltzj
520
39k
Transcript
Attractive things work better… When you wash and wax a
car, it drives better, doesn’t it? Or at least feels like it does. David A. Norman
Attractive things work better… When you wash and wax a
car, it drives better, doesn’t it? Or at least feels like it does. David A. Norman
Robert Wijas
Robert Wijas
Robert Wijas
Robert Wijas
None
None
UIAppearance on Steroids UISS
Quick introduction UIAppearance
Protocols @protocol UIAppearance <NSObject> ! + (id)appearance; ! + (id)appearanceWhenContainedIn:(Class
<UIAppearanceContainer>)ContainerClass, ... NS_REQUIRES_NIL_TERMINATION; ! @end ! ! @protocol UIAppearanceContainer <NSObject> @end
Properties - (void)setProperty:(PropertyType)property forAxis1:(IntegerType)axis1 axisN:(IntegerType)axisN; ! - (PropertyType)propertyForAxis1:(IntegerType)axis1 axisN:(IntegerType)axisN; #define
UI_APPEARANCE_SELECTOR
None
[[UIButton appearance] setTitleColor:[[UIColor whiteColor] colorWithAlphaComponent:0.800] forState:UIControlStateNormal]; [[UIButton appearance] setTitleColor:[UIColor whiteColor]
forState:UIControlStateHighlighted]; [[UIButton appearance] setBackgroundImage:[[UIImage imageNamed:@"button-background-normal"] resizableImageWithCapInsets:UIEdgeInsetsMake(0.0, 10.0, 0.0, 10.0)] forState:UIControlStateNormal]; [[UIButton appearance] setBackgroundImage:[[UIImage imageNamed:@"button-background-highlighted"] resizableImageWithCapInsets:UIEdgeInsetsMake(0.0, 10.0, 0.0, 10.0)] forState:UIControlStateHighlighted]; [[UILabel appearanceWhenContainedIn:[UIButton class], nil] setFont:[UIFont fontWithName:@"Copperplate-Bold" size:18.0]]; [[UIButton appearance] setTitleEdgeInsets:UIEdgeInsetsMake(1.0, 0.0, 0.0, 0.0)];
None
UISS JSON Syntax
UISS JSON Syntax "UIButton":{ "titleColor:normal":["white", 0.8], "titleColor:highlighted":"white", ! "backgroundImage:normal": ["button-background-normal",
[0,10,0,10]], "backgroundImage:highlighted": ["button-background-highlighted", [0,10,0,10]], ! "titleEdgeInsets": [1,0,0,0], ! "UILabel":{ "font":["Copperplate-Bold", 18] } }
"UIButton":{ "titleColor:normal":["white", 0.8], "titleColor:highlighted":"white", ! "backgroundImage:normal": ["button-background-normal", [0,10,0,10]], "backgroundImage:highlighted": ["button-background-highlighted",
[0,10,0,10]], ! "titleEdgeInsets": [1,0,0,0], ! "UILabel":{ "font":["Copperplate-Bold", 18] } } UIAppearance objects and containment
"UIButton":{ "titleColor:normal":["white", 0.8], "titleColor:highlighted":"white", ! "backgroundImage:normal": ["button-background-normal", [0,10,0,10]], "backgroundImage:highlighted": ["button-background-highlighted",
[0,10,0,10]], ! "titleEdgeInsets": [1,0,0,0], ! "UILabel":{ "font":["Copperplate-Bold", 18] } } Properties
"UIButton":{ "titleColor:normal":["white", 0.8], "titleColor:highlighted":"white", ! "backgroundImage:normal": ["button-background-normal", [0,10,0,10]], "backgroundImage:highlighted": ["button-background-highlighted",
[0,10,0,10]], ! "titleEdgeInsets": [1,0,0,0], ! "UILabel":{ "font":["Copperplate-Bold", 18] } } Axis parameters
"clear" [UIColor clearColor] ! ["#ffffff", 0.5] [UIColor colorWithRed:255.0f green:255.0f blue:255.0f
alpha:0.5f] ! [0, 255, 255, 0.5] [UIColor colorWithRed:0.0f green:255.0f blue:255.0f alpha:0.5f] Colors
14 [UIFont systemFontOfSize:14.0f] ! ["bold", 14] [UIFont boldSystemFontOfSize:14.0f] ! ["Georgia-Italic",
12] [UIFont fontWithName:@"Georgia-Italic" size:12.0f] Fonts
"imageName" [UIImage imageNamed:@"imageName"] ! ["imageName", 1, 2, 3, 4] [[UIImage
imageNamed:@"imageName"] resizableImageWithCapInsets:UIEdgeInsetsMake(1, 2, 3, 4)] Images
"UINavigationBar":{ "Phone":{ "tintColor":"gray" }, "Pad":{ "tintColor":"lightGray" } } UI Idiom
Branches
"Variables":{ "tint":"blue", “toolbar”:{ "tintColor": "$tint" } }, "UINavigationBar":{ "tintColor": "$tint"
}, "UITabBar":{ "tintColor": "$tint" }, "UIToolbar":”$toolbar” Variables
"UISSDemoViewController":{ "-UIButton":{ "titleColor:normal":["white", 0.8], "titleColor:highlighted":"white" } } Comments
None
None
Simple Setup
one line of code Simple Setup
Simple Setup [UISS configureWithDefaultJSONFile]; uiss.json
How to make it really cool?
How to make it really cool? Live updates
Remote Style [UISS configureWithDefaultJSONFile]
Remote Style [UISS configureWithURL:[NSURL URLWithString:@"http://localhost/uiss.json"]]
How-to Remote uiss.json
curl get.pow.cx | sh http://pow.cx
None
None
None
None
UIAppearance - (NSMutableArray *)_appearanceInvocations;
Swizzling TaggingAppearanceGeneralSetterIMP ()
When the magic happens
[UIView(Hierarchy) addSubview:] When the magic happens
- (void)reloadAppearance { NSArray * windows = [UIApplication sharedApplication].windows; for
(UIWindow *window in windows) { for (UIView *view in window.subviews) { [view removeFromSuperview]; [window addSubview:view]; } } } Reload appearance
None
UIAppearance weakness Selectors
subclassing UIAppearance weakness Selectors
subclassing UIAppearance weakness custom properties Selectors
Alternatives
Alternatives
Alternatives https://github.com/tombenner/nui
None
None
Layout
Layout Auto
attribute1 == multiplier × attribute2 + constant
attribute1 == multiplier × attribute2 + constant >= <= Left
Right Top Bottom Leading Trailing Width Height CenterX CenterY Baseline Left Right Top Bottom Leading Trailing Width Height CenterX CenterY Baseline @500
ASCII Art
|-[find]-[findNext]-[findField(>=20)]-| ASCII Art
None
Why bother?
None
None
None
None
None
http://github.com/robertwijas/UISS CocoaPods
inspired by @worrydream
None
robertwijas