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
CALayerを見直す
Search
taminif
November 28, 2016
Technology
380
1
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
CALayerを見直す
関西モバイルアプリ研究会 #20
taminif
November 28, 2016
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
330
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 Technology
See All in Technology
銀行勘定系システムにおける開発プロセス刷新×AIによる環境モダナイゼーション / Development Process Transformation and AI-Driven Environment Modernization
muit
0
860
深夜のクラウド懺悔室 1:29:300 or 1:0:0
kazzpapa3
1
240
AIエージェントの自己改善をどう設計するか / How to Design Self-Improvement for AI Agents
22mi
20
12k
人間はどの意思決定を手放せるのか
kawasima
7
2.4k
Reactの設計論
uhyo
17
9k
幾何アルゴリズムで なめらかなピン操作を / iOSDC Japan 2026 / smoothpin
kazumanagano
0
310
すぐできる衛星通信対応 あとは山奥に行くだけ
tatetate55
0
110
例外の正しい扱い方 そのエラー try-catchして大丈夫?
jinwatanabe
3
480
アプリログインとWeb認証基盤をつなぐ ASWebAuthenticationSession 作法
shimastripe
1
290
Sigmaユーザーのための有用リソース一挙公開 & Sigmaで使えるMCP #sigma_ucj /useful-resources-for-sigma-computing-users-and-mcps-with-sigma
shinyaa31
0
210
20260912_スクフェス三河
kgnkhkr
0
330
クロスボーダーM&AのValue Upを支えるプロダクト開発。日米チームのハブになったプロダクトエンジニアの実践 / Product Engineering Conference 2026
genda
0
120
Featured
See All Featured
Principles of Awesome APIs and How to Build Them.
keavy
128
18k
Code Reviewing Like a Champion
maltzj
528
40k
Bridging the Design Gap: How Collaborative Modelling removes blockers to flow between stakeholders and teams @FastFlow conf
baasie
0
700
The MySQL Ecosystem @ GitHub 2015
samlambert
251
13k
Effective software design: The role of men in debugging patriarchy in IT @ Voxxed Days AMS
baasie
0
520
Collaborative Software Design: How to facilitate domain modelling decisions
baasie
1
320
The Impact of AI in SEO - AI Overviews June 2024 Edition
aleyda
6
1.2k
Conquering PDFs: document understanding beyond plain text
inesmontani
PRO
4
3k
Agile that works and the tools we love
rasmusluckow
331
22k
Redefining SEO in the New Era of Traffic Generation
szymonslowik
1
410
Max Prin - Stacking Signals: How International SEO Comes Together (And Falls Apart)
techseoconnect
PRO
0
460
How To Speak Unicorn (iThemes Webinar)
marktimemedia
1
580
Transcript
CALayerΛݟ͢ ؔϞόΠϧΞϓϦݚڀձ #20 2016/11/28 େౡ ޫو
ࣗݾհ • ΣϒϦΦגࣜձࣾ • WEBΤϯδχΞ • ΞϓϦΤϯδχΞ ʢࣗশʣ • 8݄ʹΞϓϦΛ
ϦϦʔε͠·ͨ͠ʂ
CALayer
Core Animation Layer • άϥϑΟοΫඳըͷج൫ • ΞχϝʔγϣϯॲཧΛ୲ • iOSʹඪ४Ͱࡌ͞Ε͍ͯΔ
UIViewʹαϙʔτ
Έͳ͞ΜԿؾͳ͍ͬͯ͘ Δ͔ͱࢥ͍·͢ɻ
CALayerͰͬͯΔͣ • ӨΛམͱ͢ • ઢΛ͚ͭΔ • ؙ֯ʹ͢Δ • ʑɾɾɾ
CALayerΛ༻ͨ͠খٕΛ ຊհ͠·͢
1. CALayerΛܧঝͨ͠αϒΫϥε
CALayerΛܧঝͨ͠αϒΫϥε • CAEmitterLayer • CAGradientLayer • CAMetalLayer • CAEAGLLayer/ CAOpenGLLayer
• CAReplicatorLayer • CAScrollLayer • CAShapeLayer • CATextLayer • CATiledLayer • CATransformLayer • QCCompositionLayer
CALayerΛܧঝͨ͠αϒΫϥε • CAEmitterLayer • CAGradientLayer • CAMetalLayer • CAEAGLLayer/ CAOpenGLLayer
• CAReplicatorLayer • CAScrollLayer • CAShapeLayer • CATextLayer • CATiledLayer • CATransformLayer • QCCompositionLayer
CATextLayer override func viewDidLoad() { super.viewDidLoad() let textLayer = CATextLayer()
textLayer.frame = textView.bounds let string = "Hello! Can I have a Tall Caramel Macchiato?" textLayer.string = string let fontName:CFString = "Noteworthy-Light" as CFString let fontSize:CGFloat = 14.0 textLayer.font = CTFontCreateWithName(fontName, fontSize, nil) textLayer.foregroundColor = UIColor.darkGray.cgColor textLayer.isWrapped = true textLayer.alignmentMode = kCAAlignmentLeft textLayer.contentsScale = UIScreen.main.scale textView.layer.addSublayer(textLayer) }
2. AVPlayerLayer
AVPlayerLayer • AVFoundationʹؚ·ΕΔCALayerαϒΫϥε • mp4Λ࠶ੜͰ͖Δ • Layerͱͯ͠͏ͨΊʹҰඞཁ
AVPlayerLayer Class final class AVPlayerView : UIView { override public
class var layerClass: Swift.AnyClass { get { return AVPlayerLayer.self } } fileprivate var playerLayer: AVPlayerLayer { return self.layer as! AVPlayerLayer } func player() -> AVPlayer { return playerLayer.player! } func setPlayer(_ player: AVPlayer) { playerLayer.player = player } func setVideoFillMode(_ fillMode: String) { playerLayer.videoGravity = fillMode } func videoFillMode() -> String { return playerLayer.videoGravity } }
AVPlayerLayer Layer let path = Bundle.main.path(forResource: "cat", ofType: "mp4") let
fileURL = URL(fileURLWithPath: path!) let avAsset = AVURLAsset(url: fileURL, options: nil) let playerItem = AVPlayerItem(asset: avAsset) let videoPlayer = AVPlayer(playerItem: playerItem) let layer = playerView.layer as! AVPlayerLayer layer.videoGravity = AVLayerVideoGravityResizeAspect layer.player = videoPlayer videoPlayer.play()
3. ӨΛଆʹམͱ͢
αϯϓϧίʔυ let subLayer:CALayer = CALayer.init() subLayer.frame = image.bounds image.layer.addSublayer(subLayer) subLayer.masksToBounds
= true let size:CGSize = subLayer.bounds.size var x:CGFloat = -10.0 var y:CGFloat = -10.0 let pathRef:CGMutablePath = CGMutablePath() pathRef.move(to: CGPoint(x: x, y: y)) x += size.width + 10.0 pathRef.addLine(to: CGPoint(x: x, y: y)) y += 10.0 pathRef.addLine(to: CGPoint(x: x, y: y)) x -= size.width pathRef.addLine(to: CGPoint(x: x, y: y)) y += size.height pathRef.addLine(to: CGPoint(x: x, y: y)) x -= 5.0 pathRef.addLine(to: CGPoint(x: x, y: y)) y -= size.height pathRef.addLine(to: CGPoint(x: x, y: y)) pathRef.closeSubpath() subLayer.shadowOffset = CGSize(width: 5, height: 5) subLayer.shadowColor = UIColor.black.cgColor subLayer.shadowOpacity = 0.5 subLayer.shadowPath = pathRef
Ͳ͏͍ͬͯΔ͔ 7JFX -BZFS - B Z F S
͋Γ͕ͱ͏͍͟͝·ͨ͠