Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

You can dismiss modal viewcontroller like Facebook Messenger by pulling scrollview or navigationbar in Swift.

License

NotificationsYou must be signed in to change notification settings

sgr-ksmt/PullToDismiss

Repository files navigation

PullToDismiss provides dismiss modal viewcontroller function like Facebook Messenger by pulling scrollview or navigationbar with smooth and rich background effect.

GitHub releaseLanguageCarthage CompatibleCocoaPodsCocoaPodsDLAwesomeReviewed by Hound


sampleblur sample
gifgif

Feature

  • Support all scroll views. (UIScrollView, UITableView, UICollectionView, UIWebView, WKWebView)
  • Customizable. (dismiss background color, alpha, height percentage of dismiss)
  • Available in UIViewController, UINavigationController.
  • Automatically add pan gesture to navigation bar.
  • Blur effect support.
  • Objective-C support. (fromv2.1~)

Migration guide

If you update from 1.x to 2.0, seemigration guide if needed.

Usage

Getting Started

(1) SetupPullToDismiss

import PullToDismissclassSampleViewController:UIViewController{@IBOutletprivate weakvartableView:UITableView!privatevarpullToDismiss:PullToDismiss?overridefunc viewDidLoad(){        super.viewDidLoad()        pullToDismiss=PullToDismiss(scrollView: tableView)}}

(2) Create view controller and setmodalPresentationStyle. Then present view controller

letvc=SampleViewController()letnav=UINavigationController(rootViewController: vc)nav.modalPresentationStyle=.overCurrentContextself.present(nav, animated:true, completion:nil)

👍👍👍

Use(UIScrollView|UITableView|UICollectionView)Delegate

You can use all scroll view's delegate by setpullToDismiss.delegate.

import PullToDismissclassSampleViewController:UIViewController{@IBOutletprivate weakvartableView:UITableView!privatevarpullToDismiss:PullToDismiss?overridefunc viewDidLoad(){        super.viewDidLoad()        pullToDismiss=PullToDismiss(scrollView: tableView)        pullToDismiss?.delegate=self}}extensionSampleViewController:UITableViewDelegate{func scrollViewDidScroll(_ scrollView:UIScrollView){        // ...}func tableView(_ tableView:UITableView, didSelectRowAt indexPath:IndexPath){        // ...}}

Customize

You can customize backgroundEffect, dismissableHeightPercentage:

Shadow background effet

  • background (default:ShadowEffect.default, [color: black, alpha: 0.8])

img1

pullToDismiss?.background=ShadowEffect(color:.red, alpha:0.5) // color: red, alpha: 0.5

Blur background effect

New feature for v1.0.

gif

// preset blur (.extraLight, .light, .dark)pullToDismiss?.background=BlurEffect.extraLight// set custom BlurpullToDismiss?.background=BlurEffect(color:.red, alpha:0.5, blurRadius:40.0, saturationDeltaFactor:1.8)

dismissableHeightPercentage

img2

// to pull half size of view controller, dismiss view controller.pullToDismiss?.dismissableHeightPercentage=0.5

Requirements

  • iOS 8.0+ (blur effect: iOS 9.0+)
  • Xcode 8.1+
  • Swift 3.0+

Installation

Carthage

  • Add the following to yourCartfile:
# Swift 5.0 or latergithub"sgr-ksmt/PullToDismiss"~> 2.2# Swift 3github"sgr-ksmt/PullToDismiss", 2.1

CocoaPods

PullToDismiss is available throughCocoaPods. To installit, simply add the following line to your Podfile:

# Swift 5.0 or laterpod'PullToDismiss','~> 2.2'# Swift 3pod'PullToDismiss','2.1'

and runpod install

Manually Install

Download all*.swift files and put your project.

Change log

Change log ishere.

Communication

  • If you found a bug, open an issue.
  • If you have a feature request, open an issue.
  • If you want to contribute, submit a pull request.:muscle:

License

PullToDismiss is under MIT license. See theLICENSE file for more info.

About

You can dismiss modal viewcontroller like Facebook Messenger by pulling scrollview or navigationbar in Swift.

Topics

Resources

License

Contributing

Stars

Watchers

Forks

Sponsor this project

 

Packages

No packages published

Contributors6


[8]ページ先頭

©2009-2026 Movatter.jp