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
270
「とりあえずAI」が招く悲劇〜私がAIで生産性を下げるまでの話〜 / The tragedy caused by "AI for now" - The story of how I used AI to reduce my productivity
taminif
1
340
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
550
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
The Past, Present, and Future of Enterprise Java
ivargrimstad
0
470
『寄り添うラジオ』をAIで作る 体験価値から逆算した、会話しないUXと品質設計
theoriatec2024
3
180
標準パッケージに uuid が追加された 背景から見る Go らしい意思決定 / go_127_uuid_decision
convto
5
7.5k
そのリトライ、死んだコネクションを使い回していませんか ── GoのHTTPクライアントとHTTP/2を実プロダクト障害から学び直す
myus4a
0
150
WebMCP Challenge に星空観察アプリで参加した話
okajun35
0
180
LL言語やWebフレームワークのPostgreSQL対応 〜DBの機能がユーザーに届くまで〜
kentaroutakeda
1
150
AWS DevOps Agentで インシデント対応をAIに任せたい
honmarkhunt
7
3k
UnityでSystem.Net.WebSocketsなWebSocketサーバが動かないのでUnity Monoのコードを覗いてみた / about implementing websocket server with unity mono
drumath2237
1
190
JPUG勉強会 OSSデータベースの内部構造を理解しよう(第2回)
oga5
0
260
スマートフォンでモールス信号を送受信する 〜スマートフォンのLEDとカメラで作る光通信の設計と実装〜
atsuki_seo
0
150
Go × SIMDで高速化するベクトル検索 ~ルーフラインモデルでSIMDが効く境界を探れ! ~
po3rin
1
2k
一人だけ、Kiroが静止する日
hideg
0
120
Featured
See All Featured
世界の人気アプリ100個を分析して見えたペイウォール設計の心得
akihiro_kokubo
PRO
74
42k
Reality Check: Gamification 10 Years Later
codingconduct
0
2.3k
Efficient Content Optimization with Google Search Console & Apps Script
katarinadahlin
PRO
1
870
How to build an LLM SEO readiness audit: a practical framework
nmsamuel
1
910
Making Projects Easy
brettharned
120
6.8k
AI Search: Where Are We & What Can We Do About It?
aleyda
0
8k
svc-hook: hooking system calls on ARM64 by binary rewriting
retrage
2
580
The Mindset for Success: Future Career Progression
greggifford
PRO
0
500
Highjacked: Video Game Concept Design
rkendrick25
PRO
1
460
Building Applications with DynamoDB
mza
96
7.2k
Winning Ecommerce Organic Search in an AI Era - #searchnstuff2025
aleyda
2
2.1k
Java REST API Framework Comparison - PWX 2021
mraible
34
9.7k
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Λ༻͢Δ • ੍มߋͨ͠෦Ҏ֎ӨڹΛड͚ͳ͍
͋Γ͕ͱ͏͍͟͝·ͨ͠