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
役立つログに取り組もう
irof
28
9.6k
Outline View in SwiftUI
1024jp
1
330
よくできたテンプレート言語として TypeScript + JSX を利用する試み / Using TypeScript + JSX outside of Web Frontend #TSKaigiKansai
izumin5210
6
1.7k
RubyLSPのマルチバイト文字対応
notfounds
0
120
見せてあげますよ、「本物のLaravel批判」ってやつを。
77web
7
7.8k
Less waste, more joy, and a lot more green: How Quarkus makes Java better
hollycummins
0
100
subpath importsで始めるモック生活
10tera
0
310
Pinia Colada が実現するスマートな非同期処理
naokihaba
4
230
TypeScriptでライブラリとの依存を限定的にする方法
tutinoko
3
690
Jakarta EE meets AI
ivargrimstad
0
200
聞き手から登壇者へ: RubyKaigi2024 LTでの初挑戦が 教えてくれた、可能性の星
mikik0
1
130
Creating a Free Video Ad Network on the Edge
mizoguchicoji
0
120
Featured
See All Featured
Build your cross-platform service in a week with App Engine
jlugia
229
18k
[RailsConf 2023] Rails as a piece of cake
palkan
52
4.9k
Sharpening the Axe: The Primacy of Toolmaking
bcantrill
38
1.8k
10 Git Anti Patterns You Should be Aware of
lemiorhan
655
59k
Faster Mobile Websites
deanohume
305
30k
The MySQL Ecosystem @ GitHub 2015
samlambert
250
12k
The World Runs on Bad Software
bkeepers
PRO
65
11k
Java REST API Framework Comparison - PWX 2021
mraible
PRO
28
8.2k
Design and Strategy: How to Deal with People Who Don’t "Get" Design
morganepeng
126
18k
The Straight Up "How To Draw Better" Workshop
denniskardys
232
140k
Optimising Largest Contentful Paint
csswizardry
33
2.9k
VelocityConf: Rendering Performance Case Studies
addyosmani
325
24k
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