Giter Site home page Giter Site logo

fabs moves in tableview about floaty HOT 4 CLOSED

kciter avatar kciter commented on July 16, 2024
fabs moves in tableview

from floaty.

Comments (4)

kciter avatar kciter commented on July 16, 2024 1

Hello @StevenArmandLee
I'm sorry for being late.

If you can possible, use the below.

override func viewDidLoad() {
    KCFABManager.defaultInstance().show()
}

override func scrollViewWillEndDragging(_ scrollView: UIScrollView, withVelocity velocity: CGPoint, targetContentOffset: UnsafeMutablePointer<CGPoint>) {
    if velocity.y > 0 {
        KCFABManager.defaultInstance().hide()
    } else {
        KCFABManager.defaultInstance().show()
    }
}

Or I added sticky property in version 2.1.0.

override func viewDidLoad() {
    super.viewDidLoad();
    fab.sticky = true // sticking to parent UIScrollView(also UITableView, UICollectionView)
    view.addSubview(fab)
}

override func scrollViewWillEndDragging(_ scrollView: UIScrollView, withVelocity velocity: CGPoint, targetContentOffset: UnsafeMutablePointer<CGPoint>) {
    if velocity.y > 0 {
        fab.isHidden = true
    } else {
        fab.isHidden = false
    }
}

from floaty.

StevenArmandLee avatar StevenArmandLee commented on July 16, 2024

I found the solution by using this

override func scrollViewDidScroll(_ scrollView: UIScrollView) {
        floatingActionButton.paddingY = 20-scrollView.contentOffset.y
        if scrollView.contentOffset.y == 0 {
            floatingActionButton.paddingY = 20
        }
    }

This works perfectly fine for me, in case you want to make it hidden when you scroll up, add this line also

        if scrollView.contentOffset.y <= 45 {
            floatingActionButton.isHidden = false
        }
        else {
            floatingActionButton.isHidden = true
        }

ERROR, it will be placed at wrong place when we scroll up and down many many times, when I check the location of the contentOffset.y, it is at the right place, however in my UI it is under my screen

from floaty.

StevenArmandLee avatar StevenArmandLee commented on July 16, 2024

@kciter btw I noticed that the button is solid color when I use it in a view controller which contain table view

while it is transparent color at tableviewcontroller (I can see the line between cells)

how do I make all of them a solid color? I made sure my alpha is 1

from floaty.

StevenArmandLee avatar StevenArmandLee commented on July 16, 2024

@kciter ok so the color is correct is just that somehow the cell separator is in front of the button. and when we click the button it will go to the front of the cell separator. tried to put it to the most front and it does not work also

any solution?

from floaty.

Related Issues (20)

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.