Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Sign up for free
Menu
Search
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Pricing
Search
Sign in
Sign up for free
iOS で CSS スキニング
Search
Toshihiro Morimoto
June 22, 2013
Programming
1.4k
2
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
iOS で CSS スキニング
NUI を使って CSS スキニングしてみたお話
Toshihiro Morimoto
June 22, 2013
Transcript
100 slides
iOS Ͱ CSS εΩχϯά @dealforest Toshihro Morimoto 2013/06/22 yidev@ौ୩ษڧձ ୈҰճ
ΞδΣϯμ • ࣗݾհ • Ϟνϕʔγϣϯ • ϥΠϒϥϦൺֱ • NUI ʹ͍ͭͯ
• ·ͱΊ
ࣗݾհ http://about.me/dealforest iOS ͷΞϓϦͭͬͨ͘Γ Ruby ॻ͍ͨΓ Perl ॻ͍ͨΓ Flash ͬͨΓͯ͠·ͨ͠
@dealforest Toshihro Morimoto
ϩδοΫͱελΠϧΛ ͍ͨ͠ Ϟνϕʔγϣϯ
ͦͦ σβΠϯΛमਖ਼͢ΔͨΊʹ ίʔυΛมߋ͢Δͷ ΊΜͲ͍͘͞
ʊਓਓਓਓਓਓਓਓਓਓਓਓਓਓਓਓਓʊ ʼɹશମతʹϑΥϯταΠζมߋͯ͠ɹʻ ʉY^Y^Y^Y^Y^Y^Y^Y^Y^Y^Y^Y^Y^Y^Y^Yʉ
ʊਓਓਓਓਓਓਓਓਓਓਓʊ ʼɹϑΥϯτ͜Εʹͯ͠ɹʻ ʉY^Y^Y^Y^Y^Y^Y^Y^Y^Yʉ
ʊਓਓਓਓਓਓਓਓਓਓਓਓਓʊ ʼɹӨͷΦϑηοτͣΒͯ͠ɹʻ ʉY^Y^Y^Y^Y^Y^Y^Y^Y^Y^Y^Yʉ
ͳΜͯ͜ͱ ৗ൧ࣄʹ͋Γ·͢Ͷ
Storyboard มߋͯ͠... nib ϑΝΠϧΛมߋͯ͠... ίʔυͰมߋͯ͠....
ͳΜͯຖճΓͨ͘ͳ͍!!
ͦΜͳ࣌ʹҰΧॴमਖ਼͢Ε શͯө͞ΕΕ͍͍ͷʹͳ...
ͦΕ͕Ͱ͖ΔͷͰ͢
UILabel ͷ߹ CGRect frame = CGRectMake(0, 0, 100, 100); UILabel
*label = [[UILabel alloc] initWithFrame:frame]; label.text = @"NUI demo"; label.font = [UIFont fontWithName:@"Helvetica" size:16]; label.textColor = [UIColor blueColor]; label.shadowColor = [UIColor grayColor]; label.shadowOffset = CGSizeMake(1, 1); label.textAlignment = NSTextAlignmentCenter; label.backgroundColor = [UIColor whiteColor];
UILabel ͷ߹ CGRect frame = CGRectMake(0, 0, 100, 100); UILabel
*label = [[UILabel alloc] initWithFrame:frame]; label.text = @"NUI demo"; // ↓ ͜Ε͔ΒԼελΠϧ label.font = [UIFont fontWithName:@"Helvetica" size:16]; label.textColor = [UIColor blueColor]; label.shadowColor = [UIColor grayColor]; label.shadowOffset = CGSizeMake(1, 1); label.textAlignment = NSTextAlignmentCenter; label.backgroundColor = [UIColor whiteColor];
NUI ༻ͨ͠ UILabel CGRect frame = CGRectMake(0, 0, 100, 100);
UILabel *label = [[UILabel alloc] initWithFrame:frame]; label.text = @"NUI demo"; label.nuiClass = @"SampleLabel"; SampleLabel { font-name: Helvetica; font-size: 16 font-color: blue; shadow-color: gray; shadow-offset: 1, 1; text-align: center; background-color: white; } NSSϑΝΠϧ
NUI Λ͏ͱ͜ͷΑ͏ʹ NSS ϑΝΠϧʹఆٛͯ͠ ཧ͢Δ͜ͱ͕Ͱ͖·͢
NUI Ҏ֎ʹϥΠϒϥϦ͕͋ΔͷͰ ·ͣͦΕΒΛܰ͘;Ε͍͖ͯ·͢
ϥΠϒϥϦൺֱ
ϥΠϒϥϦൺֱ •NimbusKit
ϥΠϒϥϦൺֱ •NimbusKit •NUI
ϥΠϒϥϦൺֱ •NimbusKit •NUI •Pixate
NimbusKit
NimbusKit • ৭ʑͱศརͳπʔϧ͕ೖͬͨϑϨʔϜ ϫʔΫ
NimbusKit • ৭ʑͱศརͳπʔϧ͕ೖͬͨϑϨʔϜ ϫʔΫ • CSS εΩχϯάʹ͍ͭͯͰ͖Δ͜ͱ ͕গͳ͗͢Δ UIAppearance Ͱͬͨํ͕Ϛγ
ࢦఆͰ͖ΔελΠϧ͜͜ʹҰཡ͕͋Γ·͢ http://docs.nimbuskit.info/group___c_s_s-_stylesheets.html
NUI
NUI • OSS (MIT License)
NUI • OSS (MIT License) • pading, margin ͳ͍ɻ͋͘·Ͱ০ͷΈ
NUI • OSS (MIT License) • pading, margin ͳ͍ɻ͋͘·Ͱ০ͷΈ •
version 0.2.5 Ҏ߱ iOS6 Ҏ্͕ඞਢ
NUI • OSS (MIT License) • pading, margin ͳ͍ɻ͋͘·Ͱ০ͷΈ •
version 0.2.5 Ҏ߱ iOS6 Ҏ্͕ඞਢ • iOS7 ରԠதͱͷ͜ͱ
Pixate
Pixate • NUI ΑΓɺΑΓ CSS ϥΠΫͳࢦఆ
Pixate • NUI ΑΓɺΑΓ CSS ϥΠΫͳࢦఆ • ແྉͰ͔ͭ͑ΔΑ͏ʹͳΓ·ͨ͠ɻ ͨͩ͠ඇӦརత͔ͭձࣾͩͱ10໊·Ͱ
Pixate • NUI ΑΓɺΑΓ CSS ϥΠΫͳࢦఆ • ແྉͰ͔ͭ͑ΔΑ͏ʹͳΓ·ͨ͠ɻ ͨͩ͠ඇӦརత͔ͭձࣾͩͱ10໊·Ͱ •
RubyMotion, Titanium, MonoTouch Ͱར༻Մೳ
Pixate • NUI ΑΓɺΑΓ CSS ϥΠΫͳࢦఆ • ແྉͰ͔ͭ͑ΔΑ͏ʹͳΓ·ͨ͠ɻ ͨͩ͠ඇӦརత͔ͭձࣾͩͱ10໊·Ͱ •
RubyMotion, Titanium, MonoTouch Ͱར༻Մೳ • Framework Ͱ͞ΕΔͷͰϒϥοΫϘοΫε
ελΠϧࢦఆͰ͖Δछྨͷɹ Pixate > NUI >>>> NimbusKit
ϥΠϒϥϦൺֱ
ϥΠϒϥϦൺֱ • Pixate ͩͱ pading, margin ΛࢦఆͰ͖Δά ϥσʔγϣϯࡉ͔͘ઃఆͰ͖Δ
ϥΠϒϥϦൺֱ • Pixate ͩͱ pading, margin ΛࢦఆͰ͖Δά ϥσʔγϣϯࡉ͔͘ઃఆͰ͖Δ • NUI
͋͘·ͰελΠϧͷΈɹɹɹɹɹ Ґஔௐ ࣗྗͰ͕ΜΔ
ϥΠϒϥϦൺֱ • Pixate ͩͱ pading, margin ΛࢦఆͰ͖Δά ϥσʔγϣϯࡉ͔͘ઃఆͰ͖Δ • NUI
͋͘·ͰελΠϧͷΈɹɹɹɹɹ Ґஔௐ ࣗྗͰ͕ΜΔ ͨͩ͠ Storyboard Λ͏͜ͱͰ ɹ ͦͷลΓͷࠩຒΊΕΔ
ݸਓతʹ storybord, nib Λ͏ͳΒ NUI Ͱ͍͍͔ͳͱࢥͬͯ·͢
ͱ͍͏Θ͚Ͱ͜Ε͔Β NUI ʹ͍ͭͯͰ͢
version 0.2.9
NUI Λ͏ͱ ͜͏͍͏͜ͱ͕ ؆୯ʹͰ͖·͢
before after
ηοτΞοϓ
CocoaPods༻࣌ Podfile platform :ios, '6.0' pod ‘NUI’ $ pod install
main.m int main(int argc, char *argv[]) { @autoreleasepool { [NUISettings
initWithStylesheet:@"NSSϑΝΠϧΛࢦఆ͢Δ"]; return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class])); } }
AppDelegate.m - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { [NUIAppearance init]; ...
return YES; }
͜Ε͚ͩͰಈ͖·͢
ελΠϧͷॻ͖ํ @primaryFontNameBold: HelveticaNeue-Bold; @primaryFontSize: 17; Button { background-color: red; font-color:
#FFFFFF; font-color-highlighted: rgb(204, 204, 204) font-name: @primaryFontNameBold; font-size: @primaryFontSize; corner-radius: 6; }
ελΠϧͷॻ͖ํ @primaryFontNameBold: HelveticaNeue-Bold; @primaryFontSize: 17; BlueButton { background-color: blue; font-color:
#FFFFFF; font-color-highlighted: rgb(204, 204, 204) font-name: @primaryFontNameBold; font-size: @primaryFontSize; corner-radius: 6; }
https://github.com/tombenner/nui Կ͕ࢦఆͰ͖Δ͔ README Λࢀর͍ͯͩ͘͠͞
ελΠϧࢦఆํ๏
ελΠϧࢦఆํ๏ 1. ཁૉ(UIButton, UILabel ...)Λࢦఆͯ͠ελ ΠϧΛө͢Δ
ελΠϧࢦఆํ๏ 1. ཁૉ(UIButton, UILabel ...)Λࢦఆͯ͠ελ ΠϧΛө͢Δ 2. ಠࣗΫϥεΛఆٛͯ͠ελΠϧΛࢦఆ ͢Δ
1.ཁૉΛࢦఆͯ͠ελΠϧΛө͢Δ
1.ཁૉΛࢦఆͯ͠ελΠϧΛө͢Δ • NSS ϑΝΠϧͰఆٛ͢Δ
1.ཁૉΛࢦఆͯ͠ελΠϧΛө͢Δ • NSS ϑΝΠϧͰఆٛ͢Δ • શͯͷΠϯελϯεʹө͞ΕΔ
1.ཁૉΛࢦఆͯ͠ελΠϧΛө͢Δ • NSS ϑΝΠϧͰఆٛ͢Δ • શͯͷΠϯελϯεʹө͞ΕΔ • ఆ͕ٛͨ͠ಛఆͷΠϯελϯεʹελΠ ϧΛద༻͠ͳ͍ํ๏༻ҙ͞Ε͍ͯΔ (ྫ)
nuiClass = @”none”
2. ಠࣗΫϥεΛఆٛͯ͠ελΠϧΛࢦఆ͢Δ
2. ಠࣗΫϥεΛఆٛͯ͠ελΠϧΛࢦఆ͢Δ • NSS ϑΝΠϧͰఆٛͯ͠ Storyboard ͘͠ίʔυͰ nuiClass Λࢦఆ͢Δ
2. ಠࣗΫϥεΛఆٛͯ͠ελΠϧΛࢦఆ͢Δ • NSS ϑΝΠϧͰఆٛͯ͠ Storyboard ͘͠ίʔυͰ nuiClass Λࢦఆ͢Δ •
ΠϯελϯεຖʹελΠϧΛࢦఆ͢Δ
2. ಠࣗΫϥεΛఆٛͯ͠ελΠϧΛࢦఆ͢Δ • NSS ϑΝΠϧͰఆٛͯ͠ Storyboard ͘͠ίʔυͰ nuiClass Λࢦఆ͢Δ •
ΠϯελϯεຖʹελΠϧΛࢦఆ͢Δ • ελΠϧͷܧঝͰ͖Δ (ྫ) nuiClass=@”Label:TitleLabel”
StoryboardͰελΠϧΛࢦఆ
ίʔυͰελΠϧΛࢦఆ
ίʔυͰελΠϧΛࢦఆ CGRect frame = CGRectMake(0, 0, 100, 100); UILabel *label
= [[UILabel alloc] initWithFrame:frame]; label.nuiClass = @"titleLabel"; [self.view addSubview:label];
ίʔυͰελΠϧΛࢦఆ CGRect frame = CGRectMake(0, 0, 100, 100); UILabel *label
= [[UILabel alloc] initWithFrame:frame]; label.nuiClass = @"titleLabel"; [self.view addSubview:label]; CGRect frame = CGRectMake(0, 0, 100, 100); UILabel *label = [[UILabel alloc] initWithFrame:frame]; [NUIRenderer renderLabel:label withClass:@"titleLabel"]; [self.view addSubview:label];
ͱ͍͏͜ͱ্खʹཁૉΛࢦఆͯ͠ ελΠϧΛө͢Ε ݟͨΛҰؾʹ͔͑ΕΔͷͰʁʂ
αϯϓϧݟΔݶΓ ͜ΕͰ͍͚Δʂʂʂʂ
͍͚Δ...
...
ੈͷதͦΜͳ͋͘Γ·ͤΜͰͨ͠
ͦΜͳੈքݬͰͨ͠
ͱɺ͍͏Θ͚Ͱ ্ख͍͔͘ͳ͔ͬͨσϞͰ͢
before after Googolplex.NUI.nssΛ༻
σϞ
શମͷελΠϧΛมߋͨ͠ ࡍͷӨڹൣғ
before after UIActionSheet
before after UIActionSheet UIView ͷഎܠ৭ΛനͰ ࢦఆͨ͠Өڹ
before after UIActionSheet
before after UIActionSheet UILabel ͷจࣈ৭ΛനͰ ࢦఆͨ͠Өڹ
before after UIDatePicker
before after UIDatePicker UIView ͷഎܠ৭ΛനͰ ࢦఆͨ͠Өڹ
before after UIActivityViewController
before after UIActivityViewController UIButton ͷഎܠ৭ΛͰ ࢦఆͨ͠Өڹ
before after UIImagePickerController
before after UIImagePickerController CancelϘλϯΛมߋͰ͖ͳ͍
UISegmentedControl
UISegmentedControl webview ͷதͷ textfield ͷબ࣌Ͱ Өڹ͕ͰΔ
UIBarButtonItem
UIBarButtonItem UIBarButtonItemSystemItemΛ Λ͏ͱ UIButton ѻ͍ʹͳΔ
UIWebView
UIWebView UIWebView Ͱ textfield Λબ ͨ࣌͠ͷ Done Ϙλϯ UIBarButtonItem
·ͱΊ • શମͷελΠϧΛมߋͤ͞Δͷة ݥ͕͍ͬͺ͍ɻ ͳ͍ཁૉ͚ͩΛมߋ͢Δ (NavigationBar, BarButton, BarButtonBack ) •
େਓ͘͠ nuiClass Λࢦఆͯ͠ελΠ ϧΛө͠ͱ͍ͨํ͕ͤʹͳΓ·͢
͋͘·Ͱݱঢ়Ͱ͋Γόʔδϣϯ͕ ͕͋ΔͱཁૉΛࢦఆͯ͠มߋͯ͠ ͕ͳ͍Α͏ʹͳΔ͔...
ࠓޙʹظ
հͨ͠αϯϓϧ github ʹ͋Γ·͢ https://github.com/dealforest/workshops/tree/master/ 20130622_yidev
͝ਗ਼ௌ͋Γ͕ͱ͏͍͟͝·ͨ͠ɻ
More Decks by Toshihiro Morimoto
See All by Toshihiro Morimoto
Xcode8 で開発はどうかわったのか
dealforest
10
6.6k
魅せるデバッグ技術
dealforest
4
1.6k
LLDB の世界からみた Swift
dealforest
4
5.6k
Xcode で快適なデバッグライフを追い求める
dealforest
29
25k
Intrducing debug in WWDC2016
dealforest
3
860
swift build と Xcode での Build の違い
dealforest
3
2.2k
RIP Xcode Plugin 🙏
dealforest
0
4.9k
Introducing Xcode Editor Extension
dealforest
2
4.7k
Introducing Anglerfish
dealforest
2
3.7k
Other Decks in Programming
See All in Programming
Jujutsu で毎日のバージョン管理に「安心」と「直感性」を
oukayuka
0
130
祈るテストから、探索するテストへ 〜Lincheckではじめる並行処理テスト〜
yyh_gl
0
450
正解の無い問題を 「できるだけ上手く」解く ヒューリスティックで感性を磨こう。〜現実課題をプログラミングで解きあうコミュニティについて〜
allegrogiken
0
130
RaspberryPi 5で軽くはじめるk3sとtailscaleを用いたホームサーバー構築 (1)
nasum
0
460
SODA - FACT BOOK(JP)
sodainc
1
40k
React Native経験者が Flutterを30⽇間触って驚いたこと
3saito
0
210
Agentic AI with the Power of Jakarta EE
ivargrimstad
0
260
テスト駆動開発から学ぶ 達人プログラマーの型 / TechRAMEN 2026 Conference
a_okui
0
3.2k
Math.sumPreciseから学ぶ、ECMAScript仕様の数値の種類
syumai
1
1.7k
LambdaなのにVM?Lambda MicroVMsを調べてみた / About Lambda Micro VMs
ak2ie
2
110
느린 네트워크와 저사양 디바이스 사용자를 위한 웹뷰 로딩 시간 개선기
kmkim
1
290
Datadog を OTel にするメリットを考察する — Datadog との併用を実アプリで確かめる / Examining the Benefits of Moving Datadog to OTel — Testing OTel Alongside Datadog in a Real App
seike460
PRO
1
130
Featured
See All Featured
The Hidden Cost of Media on the Web [PixelPalooza 2025]
tammyeverts
2
590
Dealing with People You Can't Stand - Big Design 2015
cassininazir
367
27k
Digital Projects Gone Horribly Wrong (And the UX Pros Who Still Save the Day) - Dean Schuster
uxyall
2
4.1k
VelocityConf: Rendering Performance Case Studies
addyosmani
331
25k
Un-Boring Meetings
codingconduct
0
520
Self-Hosted WebAssembly Runtime for Runtime-Neutral Checkpoint/Restore in Edge–Cloud Continuum
chikuwait
0
970
How to Grow Your eCommerce with AI & Automation
katarinadahlin
PRO
2
370
Redefining SEO in the New Era of Traffic Generation
szymonslowik
1
550
Balancing Empowerment & Direction
lara
6
1.4k
Performance Is Good for Brains [We Love Speed 2024]
tammyeverts
12
2k
Rails Girls Zürich Keynote
gr2m
96
14k
Collaborative Software Design: How to facilitate domain modelling decisions
baasie
1
390