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
制約を使ってViewを動かす
Search
taminif
March 12, 2017
Programming
300
0
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
制約を使ってViewを動かす
taminif
March 12, 2017
More Decks by taminif
See All by taminif
React Native New Architecture 移行実践報告
taminif
1
290
「とりあえずAI」が招く悲劇〜私がAIで生産性を下げるまでの話〜 / The tragedy caused by "AI for now" - The story of how I used AI to reduce my productivity
taminif
1
350
PuppeteerとPlaywrightの15日間の演劇 / relation of Puppeteer and Playwright
taminif
3
2.3k
Redashの開発はじめました / How to get started Redash development
taminif
0
820
私の生活を変えたHeadless Chrome / Headless Chrome who changed my life
taminif
3
560
WebSocketをiOSに持ち込んで辛い思いをした経験がありますか!? / have you painful experience in web socket?
taminif
3
6.3k
LINEで馬券を購入する / Purchase a betting ticket at LINE
taminif
1
1.7k
SkyWayで一年間運用してきたけどWebRTCってつらいんじゃないの
taminif
2
1k
オンライン英会話とSkyWay
taminif
0
560
Other Decks in Programming
See All in Programming
Kotlinの15年とServer-Side Kotlin
n_takehata
1
150
作って学ぶSpring BootのAuto Configuration / JJUG Night Seminar 2026-10-19
rshindo
0
140
Herb in Rails 8.2: Your ERB views, now HTML-aware @ Kaigi on Rails 2026, Tokyo, Japan
marcoroth
2
220
AIに “答え“を書かせるのを やめてみた
___akari11
0
120
HTML-in-Canvasで作る未来のWeb UI表現
clockmaker
5
5.1k
外から家のPCの電源入れたい!をPHPで解決する
kawashimo0
1
130
SREの越境 / SRE Collaboration
y0hgi
2
310
Findy - エンジニア向け会社紹介/Findy Company Deck
findyinc
6
400k
Agents on Rails - Rails at Scale 2026
irinanazarova
0
560
UPDATE をやめる — EF Core でマスタをバージョン管理する
panda728
PRO
0
1.2k
Event is what happens
moro
2
770
re:Inventに行く前に知っておきたい現地参加のノウハウ
nokomoro3
0
420
Featured
See All Featured
Utilizing Notion as your number one productivity tool
mfonobong
4
620
The Curse of the Amulet
leimatthew05
3
16k
The browser strikes back
jonoalderson
0
1.8k
Hiding What from Whom? A Critical Review of the History of Programming languages for Music
tomoyanonymous
3
1.3k
Principles of Awesome APIs and How to Build Them.
keavy
128
18k
AI Search: Where Are We & What Can We Do About It?
aleyda
0
8.1k
Tips & Tricks on How to Get Your First Job In Tech
honzajavorek
1
800
Music & Morning Musume
bryan
48
7.4k
Building the Perfect Custom Keyboard
takai
2
910
Leo the Paperboy
mayatellez
10
2.4k
Groundhog Day: Seeking Process in Gaming for Health
codingconduct
0
410
How To Speak Unicorn (iThemes Webinar)
marktimemedia
1
600
Transcript
੍Λͬͯ ViewΛಈ͔͢ ؔϞόΠϧΞϓϦݚڀձ #23 2017/02/28 େౡ ޫو
ࣗݾհ • ΣϒϦΦגࣜձࣾWEBΤϯδχΞ • ΞϓϦΤϯδχΞ ʢࣗশʣ • ࣙॻαʔϏεͷձࣾʹۈΊͯ·͕͢ӳޠͰ͖·ͤΜ • Try!SwiftͰݟ͔͚ͨΒ͔͚͍ͯͩ͘͞ɻ
ʢӳޠॿ͚͍ͯͩ͘͞ʣ
੍ͷ͓
੍ͱ • Auto LayoutΛߏ͢ΔͨΊͷʮ݅ʯ • ཁૉͷҐஔ = ׂ߹ * ରཁૉͷҐஔ
+ ڑ Ͱߏ͞ΕΔ • ʮԣ෯ͷத৺ʯʮॎ෯ͷத৺ʯઃఆՄೳ
ྫ͑ɺࠨʹViewΛ ஔ͖͍ͨ߹
7JFXUPQ 7JFXMFBEJOH 7JFXCPUUPN 7JFXXJEUI 4VQFS7JFXXJEUI
͜ΕΛӈʹಈ͔͠·͢
͜ͷ෯͚ͩ ੍Λมߋ͠·͢
ίʔυྫ class ViewController: UIViewController { @IBOutlet var testView: UIView! @IBOutlet
var testViewLeadingConstraint: NSLayoutConstraint! @IBAction func buttonTouchDown(_ sender: Any) { self.testViewLeadingConstraint.constant = self.testView.frame.width } }
None
ಈ࡞֬ೝ
͜ΕʹΞχϝʔγϣϯΛ ͚ͭͯΈ·͢ɻ
animateՃ class ViewController: UIViewController { @IBOutlet var testView: UIView! @IBOutlet
var testViewLeadingConstraint: NSLayoutConstraint! @IBAction func buttonTouchDown(_ sender: Any) { UIView.animate(withDuration: 3.0, animations: { self.testViewLeadingConstraint.constant = self.testView.frame.width }) } }
ಈ࡞֬ೝ
Ξχϝʔγϣϯ͞Εͳ͍ʁʁ
Ξχϝʔγϣϯ͢Δํ๏ class ViewController: UIViewController { @IBOutlet var testView: UIView! @IBOutlet
var testViewLeadingConstraint: NSLayoutConstraint! @IBAction func buttonTouchDown(_ sender: Any) { self.testViewLeadingConstraint.constant = self.testView.frame.width UIView.animate(withDuration: 3.0, animations: { self.view.layoutIfNeeded() }) } } ->΄ͱΜͲͷαΠτͰಉ͡༰͕ग़ͯ͘Δ
Ξχϝʔγϣϯ͢Δ݅ View Programming Guide for iOSΑΓ • UIViewΛ༻ • frame,
boundsͳͲݶΒΕ߲ͨͷΈՄೳ • ConstraintͰઃఆ੍ͨ͠LayoutΛߋ৽͢ Δ·Ͱมߋ͞Εͳ͍ • layoutIfNeededΛݺͿ͜ͱͰஔ͕มΘΔͨ ΊΞχϝʔγϣϯ͞ΕΔʢਪଌʣ
Ԡ༻ʁྫ
ࠨʹViewΛ ೋͭஔ͍ͨ߹
XJEUI IFJHIUڞʹ 4VQFS7JFX XJEUIಉ͡Ͱɺ ্ͷ7JFXͱͷ$POTUBOU͕
Լ͚ͩΛಈ͔ͯ͠Έ·͢
੍ มߋͨ͠ConstantҎ֎ಈ͔ͳ͍
·ͱΊ • ੍IBOutletͰඥ͚Ͱ͖Δ • ੍ΛAnimationͰಈ͔͍ͨ͠߹ layoutIfNeededΛ༻͢Δ • ੍มߋͨ͠෦Ҏ֎ӨڹΛड͚ͳ͍
͋Γ͕ͱ͏͍͟͝·ͨ͠