Git Product home page Git Product logo

bottompopup's Introduction

BottomPopup

BottomPopup provides a popup-like presentation style to any view controller

What does BottomPopup do?

It is a custom presentation style for view controllers to present any view controller with slide animation from bottom of the screen.

What does it look like ?

Actually depends on your view controller, a real world examples can be seen below;

|

How is it set up?

Using CocoaPods (Recommended)

Add below line to your Podfile;

pod 'BottomPopup'

Then you can install it with pod install command.

Manual

Download the project, just drag and drop classes under BottomPopupController file to your project.

How is it used?

After install, simply make your view controller subclass of BottomPopupViewController.

For navigation controllers, it works exactly in same way, make your navigation controller subclass of BottomPopupNavigationController.

Congratulations, your view controller is ready to show 🎉

Then you can present your controller with native presentViewController:animated:completion: method, bottom popup controller will handle rest.

Customization

Bottom popup comes with couple of customizable properties. Since your view controller subclass of BottomPopupViewController now, you can override following properties in your view controller to change behaviour;

  • popupShouldDismissInteractivelty: Bool

    Determines the popup should dismiss whether interactively or not. If it is set to yes, user can dismiss popup with pulling down it down. Default is YES

  • popupHeight: BOOL

    Height value. Default is 377 pt. For example you can return UIScreen.main.bounds.size.height to give it full screen height.

  • popupTopCornerRadius: BOOL

    Corner radius of popup. Default is 10pt

  • popupPresentDuration: Double

    Present animation duration. Default is 0.5 sec

  • popupDismissDuration: Double

    Dismiss animation duration. Default is 0.5 sec

  • popupDimmingViewAlpha: CGFloat

    Target alpha value of the black-colored dimming view after present animation. Default is 0.5

  • popupShouldBeganDismiss: BOOL

    Basically controls whether user can close the popup or not. You can change this variable at the runtime to control dismiss behaviour on spesific actions. Tap on dimming view, swipe down on dimming view and pan gesture on popup dont work if this variable set to false during these actions

  • popupViewAccessibilityIdentifier: String

    Accessibility identifier of popup's view. Default is bottomPopupView

    You can see how changing of these properties changes popup's behaviour below. (Gifs are extracted from example project)

    UIViewController UINavigationController

Delegate

If you want to track popup lifecycle or current dismiss interaction percent, you can set popupDelegate;

popupVC.popupDelegate = self

Methods;

func bottomPopupViewLoaded()
func bottomPopupWillAppear()
func bottomPopupDidAppear()
func bottomPopupWillDismiss()
func bottomPopupDidDismiss()
func bottomPopupDismissInteractionPercentChanged(from oldValue: CGFloat, to newValue: CGFloat)

Questions or Advices

Just send me an email ([email protected])

bottompopup's People

Contributors

batuhansk avatar ergunemr avatar erjanmx avatar gokberkince avatar metinkilicaslan avatar yusufozgul avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

bottompopup's Issues

Controller Width on iPad

Hi,

Thanks for open source this.

I've seen how we can control the height, I'm wondering does it support customized width so that it will look even better on iPad.

Thanks

Open view

Can we open this view from top to bottom? If yes then where should be change the code?

Thank's in advance.

Add support for UIScrollViews, UITableViews and UICollectionViews

Would it be possible to add support for scroll views to this library so we can replicate UI such as the apple maps/stock app drawer. There are a few library's that do this already such as PullUpController or FloatingPanel. However these library are either very large or do not use all the latest apple APIs such as UIPresentationControllers or UIPercentDrivenInteractiveTransition.

Unable to present bottomPopup above all views

I have a view (Now playing music) above Tabbar I am adding it like this
appDelegate.window?.rootViewController?.addChild(nowPlayingView) appDelegate.window?.addSubview(miniPlayerView.view)
when I click on it. It shows the full view inside the full view there is a button that displays the BottomPopup I am unable to display the BottomPopup above the presented View I tried the different solution but only 1 worked with me

`

let transition = CATransition()

transition.type = CATransitionType.push

transition.subtype = CATransitionSubtype.fromTop

   	popupVC.view.layer.add(transition, forKey: nil)

    appDelegate.window?.rootViewController?.addChild(popupVC)

    appDelegate.window?.addSubview(popupVC.view)

    popupVC.didMove()

`
and that's lead to another issue that's I am unable to dismiss it on swipe
please, can someone help?
Thank you

Need Swift 4 Support

HI, I Could see podspec has s.swift_version = "3.0". is your pod swift 4 supportive ?
Thanks

Width proble,

Hi I use BottomPopUp to select user cards
When BottomPopUp shows width is not equal to by self.view
Screen Shot 2019-06-25 at 2 31 03 PM
I need equal width BottomPopUp with my root view

Bottom popup loading issue

I have integrated bottom popup into one of my application.
Which do have tableview on selected and row i am trying to pop up exampleViewController.
its loading first time quickly as per given inputs, on second time its takes time.
On double click on tableviewcell its loading quickly. Did not understand what went wrong.

    func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {

        print("Selected Index",indexPath.row)
        guard let popupVC = storyboard?.instantiateViewController(withIdentifier: "StatusDetailViewController") as? StatusDetailViewController else { return }
        popupVC.height = 600
        popupVC.topCornerRadius = 30
        popupVC.presentDuration = 0.3
        popupVC.dismissDuration = 0.3
        popupVC.shouldDismissInteractivelty = true
        popupVC.popupDelegate = self
        present(popupVC, animated: true, completion: nil)

    }

StatusDetailViewController is same as ExamplePopupViewController.

Use of undeclared 'BottomPopUpDelegate'

I copy pasted the BottomPopUpController folder in my project and tried to use it but I'm having this issue. It says "Use of undeclared type 'BottomPopupDelegate' " .
Screen Shot 2020-01-07 at 9 39 56 PM

What to do in this situation?

i present the navigation controller with navigationBar, which is the subclass of BottomPopupNavigationController. custom the height is 400. it manage controller A.
in some case, i need push a controller( just call B) from A, and B controller height is same as the keywindow, just like the nomal push action.
What to do in this situation?

TopPopUp?

Is it possible to show this popup from top?

Crash iOS 13 xcode 11

Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[__SwiftValue set]: unrecognized selector sent to instance

Add support for composition

Hey,

big thanks for this library, its nice to see these kind of menus done properly using UIPresentationControllers, UIPercentDrivenInteractiveTransition etc. It would be awesome if this library changes it logic from inheritance to Composition. So instead of subclassing it would be nice to just add the content view controller as a child view controller of the pop up menu.

TextField in BottomPopup

Hey, I want to add a textfield into the view.

But the keyboard is hiding it.

How can we resolve that?

Andras

How to change dynamic height based array data?

I want to reload the height after data comes from server without loosing animation effect. its jerking if call this line

(self.presentationController as? BottomPopupPresentationController)?.containerViewWillLayoutSubviews()

fileprivate func adjustListHeight()-> CGFloat{ let height = UIScreen.main.bounds.size.height * 50 / 100 // if self.dataArray.count == 0{ // // return height // }else{ // if dataArray.count > 10{ // let height = UIScreen.main.bounds.size.height * 50 / 100 // return height // }else{ // return CGFloat(((dataArray.count + 1) * 44) + 70) // } // } return height } override var popupHeight: CGFloat{ return adjustListHeight() }

Leave ViewController under Popup accessable

Is there a chance to have the ViewController under the Popup accessable?
The User should interact with both the Popup and the underlying ViewController.
Like the Maps App...

Delegate Functions

Any plans to add some delegate functions like willDismiss or didChangeToFrame?
So we can layout content under the Popup?

Method does not override any method from its superclass

I subclass the BottomPopupViewController and override the following 3 methods. I can be built on my local, but failed on the build server with Fastlane. The following errors occurred:


�[31m❌  �[0mPositionSelectViewController.swift:58:19: �[31mmethod does not override any method from its superclass�[0m

    override func getPopupHeight() -> CGFloat {
�[36m                                       ^�[0m



�[31m❌  �[0mPositionSelectViewController.swift:62:19: �[31mmethod does not override any method from its superclass�[0m

    override func getPopupPresentDuration() -> Double {
�[36m    ~~~~~~~~      ^�[0m



�[31m❌  �[0mPositionSelectViewController.swift:66:19: �[31mmethod does not override any method from its superclass�[0m

    override func getPopupDismissDuration() -> Double {

The weird thing is it can be built if I delete the override keyword of the methods(of course the functions take no effects), which lead build fail on my local.

Both my local Mac and the build server running Xcode Version 11.3.1 (11C504) with CocoaPods version 1.8.4.

Invested two days for the issue, and can't get it to work on both sides. Any help or advice will be appreciated.

Change height of navigation controller

Thanks alot first of all, this has been a very helpful library lately. Just wanted to know if I can change height of Navigation Controller according to the ViewController size e:g Root View Controller size of Navigation Controller is 200 and when I push another View controller, I want the size of Navigation Controller to be changed to 500. Is this possible currently or can it be added in future updates?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.