Shari

A77456b262557e22986345f6d0555c58?s=47 nakajijapan
February 08, 2017

 Shari

Kyobashi.swift x AKIBA.swift 合同勉強会
https://kyobashi-swift.connpass.com/event/48794/

A77456b262557e22986345f6d0555c58?s=128

nakajijapan

February 08, 2017
Tweet

Transcript

  1. ,ZPCBTIJTXJGUY",*#"TXJGU !OBLBKJKBQBO Shari minneʹಋೖͯ̍͠೥

  2. AKIBA.swift Kyobashi.swift Shibuya.swift

  3. @nakajijapan GMO PEPABO inc. Principal Engineer iOS / Web /

    OS X About Me Daichi Nakajima
  4. ϋϯυϝΠυ࡞඼Λ ചΕΔɺങ͑Δɻ ࠃ಺࠷େڃͷ ϋϯυϝΠυϚʔέοτ

  5. NKJMultiMovieCaptureView NKJMovieComposer NKJPagerViewController PhotoSlider Teiten GitHub Sengiri Shari frustration.me Kazaguruma

  6. Shari

  7. None
  8. ࣷར • ਣ൧ • ωλͷҾཱ͖ͯ໾

  9. What is Shari?

  10. UI Component IUUQTHJUIVCDPNOBLBKJKBQBO4IBSJ

  11. None
  12. Why?

  13. Why • Χʔτͷࡏݿมߋ • UIPickerViewΛར༻͍ͯͨ͠ • ૢ࡞͕̍εςοϓ஗͍ • தԝ഑ஔ͕ετϨε

  14. Why • Χʔτͷࡏݿมߋ • UIPickerViewΛར༻͍ͯͨ͠ • ૢ࡞͕̍εςοϓ஗͍ • தԝ഑ஔ͕ετϨε ࡏݿมߋʹ̍ɺ͕̎΄ͱΜͲ

  15. ղܾ͍ͤͨ͞

  16. Want • UIPickerViewͷ୅ସ • ͳΔ΂͘؆୯ʹ • େྔͷࡏݿΛબ୒͢ΔϢʔβ΋ߟྀ

  17. Goal

  18. None
  19. Try!

  20. Animation

  21. UIPercentDrivenInte ractiveTransition

  22. UIPercentDrivenInteractiveTransition • Interactively control view controller • Percent Driven •

    update(_:), cancel(), finish() • Using gesture recognizger $MBTT IUUQTEFWFMPQFSBQQMFDPNSFGFSFODFVJLJUVJQFSDFOUESJWFOJOUFSBDUJWFUSBOTJUJPO
  23. UIViewControllerAni matorTransitioning

  24. UIViewControllerAnimatorTransitioning • Custom ViewController Transition • Define how animation you

    want to make 1SPUPDPM
  25. Πέϧ

  26. ΠέφΠ

  27. Problem

  28. Problem • ࠷ॳ͔Β࠷ޙ·Ͱͷදݱ͔͠Ͱ͖ͳ͍ • ్தͷUIͷ੍ޚ͕ೖΕΒΕͳ͍

  29. None
  30. Implementation • Using Container View Controller

  31. Half

  32. Implementation modalNavigationController.parentNavigationController = navigationController navigationController?.si.presentViewController( toViewController: modalNavigationController ) • Call

    Customized Container View Controller
  33. Implementation func presentViewController(toViewController:UIViewController) { toViewController.beginAppearanceTransition(true, animated: true) ModalAnimator.present(toView: toViewController.view, fromView:

    parentTargetView) { [weak self] in guard let strongSelf = self else { return } toViewController.endAppearanceTransition() toViewController.didMove(toParentViewController: strongSelf.base) } let tapGestureRecognizer = UITapGestureRecognizer(target: base, action: #selector(UINavigationController.overlayViewDidTap(gestureRecognizer:))) let overlayView = ModalAnimator.overlayView(fromView: parentTargetView) overlayView!.addGestureRecognizer(tapGestureRecognizer) }
  34. Implementation func presentViewController(toViewController:UIViewController) { toViewController.beginAppearanceTransition(true, animated: true) ModalAnimator.present(toView: toViewController.view, fromView:

    parentTargetView) { [weak self] in guard let strongSelf = self else { return } toViewController.endAppearanceTransition() toViewController.didMove(toParentViewController: strongSelf.base) } let tapGestureRecognizer = UITapGestureRecognizer(target: base, action: #selector(UINavigationController.overlayViewDidTap(gestureRecognizer:))) let overlayView = ModalAnimator.overlayView(fromView: parentTargetView) overlayView!.addGestureRecognizer(tapGestureRecognizer) } ൒෼͚ͩදࣔ͢ΔΞχϝʔγϣϯ
  35. Transition Background option

  36. Implementation public class ShariNavigationController: UINavigationController { func handlePanGesture(gestureRecognizer: UIPanGestureRecognizer) {

    (..snip..) case .changed: var frame = view.frame frame.origin.y += degreeY frame.size.height += -degreeY view.frame = frame ModalAnimator.transitionBackgroundView( overlayView: backgroundView, location: location) (..snip..) • Get frame using UIPanGestureRecognizer
  37. Implementation public class func transitionBackgroundView(overlayView: UIView, location:CGPoint) { let screenShotView

    = ModalAnimator.screenShotView(overlayView: overlayView) let scale = self.map( value: location.y, inMin: 0, inMax: UIScreen.main.bounds.height, outMin: 0.9, outMax: 1.0) let transform = CATransform3DMakeScale(scale, scale, 1) screenShotView.layer.removeAllAnimations() screenShotView.layer.transform = transform screenShotView.layoutIfNeeded() } • Transition in real time 5SBOTGFSBNPVOUPGNPWFNFOU (FU*NBHF
  38. None
  39. Conclusion

  40. Conclusion • ؆୯ʂʁ • ঢ়گΛ఻͑ͯϑΟʔυόοΫΛఏڙͰ͖Δ • ίϯςΩετΛҡ࣋Ͱ͖Δ • ϛεΛࣄલʹ๷͛Δ

  41. Conclusion • minneͷσβΠϯίϯϙʔωϯτͷҰͭ • Χʔτ - ࡏݿมߋ • ചΕͨ΋ͷ -

    ߜΓࠐΈ • ࡞඼ը໘ - Φϓγϣϯબ୒
  42. Shari

  43. Thanks.