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
UIPreviewInteraction: Overview
Search
Tomohiro Nishimura
June 22, 2016
Technology
650
1
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
UIPreviewInteraction: Overview
Tomohiro Nishimura
June 22, 2016
More Decks by Tomohiro Nishimura
See All by Tomohiro Nishimura
レガシーシステム洗い出し大作戦
sixeight
0
1.7k
我々のRealmはどこからやってくるのか
sixeight
1
440
まだ見ぬAPIに思いを馳せて
sixeight
0
160
復習OptionSet
sixeight
0
310
今年読んだまんが
sixeight
0
260
べんりな検索ワード
sixeight
0
280
Readable Width in action
sixeight
0
200
Accessing the Music Library
sixeight
1
2.9k
Web APIについての雑談
sixeight
0
420
Other Decks in Technology
See All in Technology
マルチアカウント環境でSecurity Hubの運用、その後どうなった? / SRE NEXT 2026 miniLT会
genda
0
110
キャリアLT会#3
beli68
0
170
41歳でAWSが好きすぎてITエンジニアになったおっさんの話
yama3133
0
610
ファミコンでPHPを動かす / PHP on the Famicom
tomzoh
2
530
Kaggleで成長するために意識したこと
prgckwb
2
430
AICoEでAIネイティブ組織への進化
yukiogawa
0
210
DatabricksにおけるMCPソリューション
taka_aki
1
310
AI時代のYAGNI:「爆速で無駄になった機能」からの学び / 20260720 Naoki Takahashi
shift_evolve
PRO
3
450
探索・可視化・自動化を一本化 Amazon Quickでデータ活用スピードを上げる方法
koheiyoshikawa
0
130
Type-safe IaC for Dart
coborinai
0
170
SREとQA 二人三脚で進めるSLO運用/sre-qa-slo
sugitak
0
1.1k
AIコード生成×サプライチェーン攻撃 — PHPが直面する“二重の信頼問題
shinyasaita
0
350
Featured
See All Featured
Un-Boring Meetings
codingconduct
0
350
HTML-Aware ERB: The Path to Reactive Rendering @ RubyCon 2026, Rimini, Italy
marcoroth
2
350
Reflections from 52 weeks, 52 projects
jeffersonlam
356
21k
The State of eCommerce SEO: How to Win in Today's Products SERPs - #SEOweek
aleyda
2
11k
Deep Space Network (abreviated)
tonyrice
0
230
Between Models and Reality
mayunak
4
380
Faster Mobile Websites
deanohume
310
32k
Designing for Performance
lara
611
70k
From π to Pie charts
rasagy
0
240
Design in an AI World
tapps
1
260
Leading Effective Engineering Teams in the AI Era
addyosmani
9
2.2k
Pawsitive SEO: Lessons from My Dog (and Many Mistakes) on Thriving as a Consultant in the Age of AI
davidcarrasco
0
190
Transcript
UIPreviewInteraction : Overview 2016/06/22 ؔϞόΠϧΞϓϦݚڀձ
id:Sixeight @tomohi_ro
None
Peek and Pop
2 ways • Storyboard Segue • UIViewControllerPreviewingDelegate
Storyboard Segue
Storyboard Segue override func prepare(for segue: UIStoryboardSegue, sender: AnyObject?) {
if segue.identifier == "previewSegue" { // for preview } }
UIViewControllerPreviewingDelegate class ItemListViewController: UITableViewController, UIViewControllerPreviewingDelegate { // ... }
UIViewControllerPreviewingDelegate override func viewDidLoad() { super.viewDidLoad() registerForPreviewing(with: self, sourceView: tableView)
}
UIViewControllerPreviewingDelegate Peek func previewingContext(_ previewingContext: UIViewControllerPreviewing, viewControllerForLocation location: CGPoint) ->
UIViewController? { guard let indexPath = tableView.indexPathForRow(at: location) else { return nil } let detailViewController = DetailViewController.instantiate() detailViewController.item = item(at: indexPath) let cellRect = tableView.rectForRow(at: indexPath) let sourceRect = previewingContext.sourceView.convert(cellRect, from: tableView) previewingContext.sourceRect = sourceRect return detailViewController }
UIViewControllerPreviewingDelegate Pop func previewingContext(_ previewingContext: UIViewControllerPreviewing, commit viewControllerToCommit: UIViewController) {
show(viewControllerToCommit, sender: self) }
None
None
How?
Custom Transitioning • UIViewControllerTransitioningDelegate • UIViewControllerAnimatedTransitioning • UIViewControllerInteractiveTransitioning • UIPresentationController
• UIGestureRecognizer
None
0.0 ʙ 1.0
UIPreviewInteraction
None
UIPreviewInteraction class DetailViewController : UIViewController { private var moreDetailPreviewInteraction: UIPreviewinteraction!
private var moreDetailVC = MoreDetailViewController() // ... }
UIPreviewInteraction override func viewDidLoad() { super.viewDidLoad() moreDetailPreviewInteraction = UIPreviewInteraction(view: view)
moreDetailPreviewInteraction.delegate = self }
UIPreviewInteractionDelegate extension DetailViewController : UIPreviewInteractionDelegate { }
UIPreviewInteractionDelegate • previewInteractionShouldBegin(_ previewInteraction: UIPreviewInteraction) -> Bool • previewInteraction(_ previewInteraction:
UIPreviewInteraction, didUpdatePreviewTransition transitionProgress: CGFloat, ended: Bool) • previewInteraction(_ previewInteraction: UIPreviewInteraction, didUpdateCommitTransition transitionProgress: CGFloat, ended: Bool)
UIPreviewInteractionDelegate • previewInteractionDidCancel(_ previewInteraction: UIPreviewInteraction)
UIPreviewInteractionDelegate func previewInteractionShouldBegin(_ previewInteraction: UIPreviewInteraction) -> Bool { return presentedViewController
!= nil }
UIPreviewInteractionDelegate func previewInteraction(_ previewInteraction: UIPreviewInteraction, didUpdatePreviewTransition transitionProgress: CGFloat, ended: Bool)
{ // Initialize if presentedViewController != nil { present(moreDetailVC, animated: true) } // Update progress moreDetailVC.interactiveTransitionProgress = transitionProgress // Peek has finished if ended { moreDetailVC.completeCurrentInteractiveTransition() } }
UIPreviewInteractionDelegate func previewInteraction(_ previewInteraction: UIPreviewInteraction, didUpdateCommitTransition transitionProgress: CGFloat, ended: Bool)
{ // Update committing progress moreDetailVC.overInteractionProgress = transitionProgress // Pop has finished if ended { tailVC.overInteractionProgress = 0.0 } }
UIPreviewInteractionDelegate func previewInteractionDidCancel(_ previewInteraction: UIPreviewInteraction) { moreDetailVC.cancelCurrentInteractiveTransition() moreDetailVC.dismiss(animated: true) }
Conclusion (Japanese) • Preview ࣗମͷڍಈΛΧελϚΠζͰ͖ΔͷͰͳͯ͘ɺ3D Touch Ͱԡ͠ࠐΜͩͱ͖ͷ Preview ͷਐḿ۩߹Λऔಘग़དྷΔ •
࣮ࡍͷ Transition ͜Ε·Ͱͷํ๏Λͦͷ··͑Δ • Cancel ͕औΕΔͷخ͍͠ؾ͕͢Δ
References • https://developer.apple.com/videos/play/wwdc2016/228/ • https://developer.apple.com/reference/uikit/ uipreviewinteraction • https://developer.apple.com/reference/uikit/ uipreviewinteractiondelegate
കӍδϝδϝͯ͠ݏͰ͢Ͷ