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
制約を使ってViewを動かす
Search
taminif
March 12, 2017
Programming
290
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
250
「とりあえずAI」が招く悲劇〜私がAIで生産性を下げるまでの話〜 / The tragedy caused by "AI for now" - The story of how I used AI to reduce my productivity
taminif
1
320
PuppeteerとPlaywrightの15日間の演劇 / relation of Puppeteer and Playwright
taminif
3
2.3k
Redashの開発はじめました / How to get started Redash development
taminif
0
810
私の生活を変えたHeadless Chrome / Headless Chrome who changed my life
taminif
3
540
WebSocketをiOSに持ち込んで辛い思いをした経験がありますか!? / have you painful experience in web socket?
taminif
3
6.2k
LINEで馬券を購入する / Purchase a betting ticket at LINE
taminif
1
1.7k
SkyWayで一年間運用してきたけどWebRTCってつらいんじゃないの
taminif
2
1k
オンライン英会話とSkyWay
taminif
0
550
Other Decks in Programming
See All in Programming
Welcome to the "Parametricity" 🏙️ − Generic だけど Specific な世界 −
guvalif
1
120
Developing with AI Agents — Codex, Claude Code & Cowork Practical Guide
x5gtrn
PRO
0
1.3k
例外の正しい扱い方 そのエラー try-catchして大丈夫?
jinwatanabe
0
340
【SRE NEXT 2026 Lunch Session】一人目専任SREの立ち上げを加速する ― AIと進めたオンボーディングで2分を0.04秒にした話
pkshadeck
PRO
0
1.6k
Language Server 使ってる? 〜VSCode と Zed の場合〜 / Are you using a Language Server? ~For VS Code and Zed~
handlename
0
830
1B+ /day規模のログを管理する技術
broadleaf
0
130
Vite+ Unified Toolchain for the Web
naokihaba
0
700
アルゴリズムは何を圧縮しているのか ─ Haskell から育った「圧縮代数」というメンタルモデル
naoya
15
2.9k
AIキャラアプリkaiwaの低遅延音声通話基盤をどう作ったか - AWS Gravitonで支える低遅延・低コストAI Agent基盤
mogamit
0
160
Go1.27で導入されるジェネリクスメソッドでできること
mackee
0
250
エンジニア向け会社紹介/Findy Company Profile
findyinc
6
360k
そのテスト、説明できますか?~LWテスト戦略FW~のご紹介
nakahara
0
200
Featured
See All Featured
Skip the Path - Find Your Career Trail
mkilby
1
160
Helping Users Find Their Own Way: Creating Modern Search Experiences
danielanewman
31
3.2k
JavaScript: Past, Present, and Future - NDC Porto 2020
reverentgeek
52
6k
Un-Boring Meetings
codingconduct
0
330
Navigating the Design Leadership Dip - Product Design Week Design Leaders+ Conference 2024
apolaine
1
370
A Guide to Academic Writing Using Generative AI - A Workshop
ks91
PRO
1
350
Making the Leap to Tech Lead
cromwellryan
135
10k
Marketing Yourself as an Engineer | Alaka | Gurzu
gurzu
0
260
Building Applications with DynamoDB
mza
96
7.1k
Between Models and Reality
mayunak
4
360
The World Runs on Bad Software
bkeepers
PRO
72
12k
Money Talks: Using Revenue to Get Sh*t Done
nikkihalliwell
0
280
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Λ༻͢Δ • ੍มߋͨ͠෦Ҏ֎ӨڹΛड͚ͳ͍
͋Γ͕ͱ͏͍͟͝·ͨ͠