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
320
「とりあえずAI」が招く悲劇〜私がAIで生産性を下げるまでの話〜 / The tragedy caused by "AI for now" - The story of how I used AI to reduce my productivity
taminif
1
360
PuppeteerとPlaywrightの15日間の演劇 / relation of Puppeteer and Playwright
taminif
3
2.4k
Redashの開発はじめました / How to get started Redash development
taminif
0
830
私の生活を変えた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
1.1k
オンライン英会話とSkyWay
taminif
0
570
Other Decks in Programming
See All in Programming
Getting Started with Vibe Coding
miccheng
0
190
flutter_test のその先へ — Flutter アプリの LLM 機能に「評価」という品質保証を
kosukesaigusa
0
200
Web3Dライブラリを作ってVue Custom Rendererの仕組みを理解しよう / lets learn vue custom renderer by making 3d library
drumath2237
1
130
Vapor Mode でアクセシビリティは 壊れないか検証した話
fuqda
1
330
Coding with AI: How to trust the storyteller (AWS Community Day Adria, Ljubljana 2026)
slobodan
0
140
AI時代のTerminal環境を UNIX哲学で設計・運用する
yasunori0418
1
350
AWS CDKを理解するために公式の定義を深掘って解説してみる / Understanding AWS CDK by Digging into Its Official Definition
akihisaikeda
3
290
作れる、でも消せるか?──安全に「枯らして消す」機能削除術 / Drain, Then Delete
chobishiba
3
1.5k
Goコンパイラを作ってGoをもっと理解する / Build a Go compiler to better understand Go
ikura_hamu
0
130
Vue.jsで作る空間解析アプリとCapacitorプラグインのData Bridge
hal_spidernight
1
170
高橋メソッドでCVE解説シリーズ 〜CVE-2026-112816〜
hakkadaikon
0
230
SODA - FACT BOOK(JP)
sodainc
1
40k
Featured
See All Featured
Skip the Path - Find Your Career Trail
mkilby
1
290
KATA
mclloyd
PRO
35
16k
Exploring the Power of Turbo Streams & Action Cable | RailsConf2023
kevinliebholz
37
6.7k
Agile that works and the tools we love
rasmusluckow
331
22k
Understanding Cognitive Biases in Performance Measurement
bluesmoon
32
3.1k
Neural Spatial Audio Processing for Sound Field Analysis and Control
skoyamalab
0
610
Statistics for Hackers
jakevdp
799
230k
We Are The Robots
honzajavorek
0
440
Building an army of robots
kneath
307
47k
Site-Speed That Sticks
csswizardry
13
1.6k
A Guide to Academic Writing Using Generative AI - A Workshop
ks91
PRO
1
560
Being A Developer After 40
akosma
PRO
92
590k
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Λ༻͢Δ • ੍มߋͨ͠෦Ҏ֎ӨڹΛड͚ͳ͍
͋Γ͕ͱ͏͍͟͝·ͨ͠