OfTheWolf / UBottomSheet

iPhone Maps App bottom sheet - A Protocol Oriented Approach
MIT License
641 stars 68 forks source link

Bottomsheet initial position wrong #64

Open minhson95th opened 3 years ago

minhson95th commented 3 years ago

In ViewController i've set

    override func viewWillLayoutSubviews() {
        guard sheetCoordinator == nil else {return}
        sheetCoordinator = UBottomSheetCoordinator(parent: self)
    }

and when click button in ViewController

 let vc = UIStoryboard(name: "Main", bundle: nil).instantiateViewController(withIdentifier: "PAHT_MoiTruongViewController") as! PAHT_MoiTruongViewController
        vc.sheetCoordinator = sheetCoordinator
        vc.dataSource = MyDataSource()
        sheetCoordinator.addSheet(vc, to: self)

and MyDataSource()

class MyDataSource: UBottomSheetCoordinatorDataSource {
    func sheetPositions(_ availableHeight: CGFloat) -> [CGFloat] {
        return [0.1, 0.6, 0.91].map{$0*availableHeight}
    }

    func initialPosition(_ availableHeight: CGFloat) -> CGFloat {
        return availableHeight*0.1
    }
}

but when initial sheet first time, position of sheet show wrong look like this image but when i drag up, it can expand look like this, and that is what i want. image How can i fix it? Thank in advance

shoaibahmaddx commented 2 years ago

@minhson95th did you ever manage to fix this issue? I am getting this error as well. @OfTheWolf please your verdict on this issue?

dzungpv commented 1 year ago

I have the issue too, on iOS 16, iPhone 14, whatever value greater 0.7 does not work, I want it expand to the top.