skywinder / ActionSheetPicker-3.0

Quickly reproduce the dropdown UIPickerView / ActionSheet functionality on iOS.
http://skywinder.github.io/ActionSheetPicker-3.0
BSD 3-Clause "New" or "Revised" License
3.4k stars 740 forks source link

How to add border to the UIToolbar #382

Closed AndreaMiotto closed 6 years ago

AndreaMiotto commented 6 years ago

Hi I'm trying to add some border to the bottom of the toolbar of the picker..

asp.toolbar is nil so I don't know ho to set it. Any tip?

AndreaMiotto commented 6 years ago

solved. Show it's needed before!

        /// Show the picker
        acp?.show()

        // Adding a bottom border to the toolbar
        guard let tool = acp?.toolbar else {
            return
        }
        let border = CALayer()
        let width = CGFloat(1.0)

        let toolHeight = tool.frame.height
        let toolWidth = tool.frame.width
        border.borderColor = UIColor.lightGray.withAlphaComponent(0.4).cgColor
        border.frame = CGRect(x: 0, y: toolHeight - width, width:  toolWidth, height: toolHeight)

        border.borderWidth = width
        acp?.toolbar.layer.addSublayer(border)
        acp?.toolbar.layer.masksToBounds = true