CaliCastle / PopMenu

A fully customizable popup style menu for iOS 😎
https://popmenu.cali.so
MIT License
1.6k stars 179 forks source link

cornerRadius of PopMenuDefaultAction doesnt do anything #60

Open omarojo opened 3 years ago

omarojo commented 3 years ago

✔️ Issue Checklist

✍🏻 Issue Description

Basically Im instantiating a PopMenuDefaultAction and then immediately setting it's cornerRadius, which has no effect to the default one.

@IBAction func btnLibraryTouchUpInside(_ sender: UIButton) {
        if(self.g8.recording == true){ return }
        let libVideoAct = PopMenuDefaultAction(title: "VIDEOS", image: #imageLiteral(resourceName: "btnBtnLoadVideoXxs"), color: nil) { (action) in
            self.showPhotoLibraryBrowser(type: kUTTypeMovie)
        }
        libVideoAct.iconWidthHeight = 40.0
        libVideoAct.cornerRadius = 0.0

        let libPhotosAct = PopMenuDefaultAction(title: "PHOTOS", image: #imageLiteral(resourceName: "btnBtnLoadImgXxs"), color: nil) { (action) in
            self.showPhotoLibraryBrowser(type: kUTTypeImage)
        }

        libPhotosAct.iconWidthHeight = 40.0
        libPhotosAct.cornerRadius = 0.0
        let actions = [libVideoAct, libPhotosAct]
        // Pass the UIView in init
        let menu = PopMenuViewController(sourceView: sender, actions: actions)
        let sepColor = UIColor(red: 35/255, green: 35/255, blue: 35/255, alpha: 1.0).cgColor
        let bgMenuColor = UIColor(red: 54/255, green: 54/255, blue: 54/255, alpha: 1.0).cgColor
        menu.appearance.popMenuItemSeparator = .fill(Color(cgColor: sepColor), height: 2.0)
        let bgColor = PopMenuColor.configure(background: PopMenuActionBackgroundColor.solid(fill: Color(cgColor: bgMenuColor)), action: PopMenuColor.default().actionColor)

        menu.appearance.popMenuColor = bgColor
        menu.appearance.popMenuBackgroundStyle = .none()
        menu.appearance.popMenuCornerRadius = 4.0
        menu.appearance.popMenuActionHeight = 44
        menu.appearance.popMenuFont = UIFont(name: ".sfuitext-bold", size: 8.0)!

        let newPosition = menu.contentFrame.offsetBy(dx: -15, dy: -45)
        menu.contentFrame = newPosition.inset(by: UIEdgeInsets(top: 0, left: 0, bottom: 0, right: 26.3))
        present(menu, animated: true, completion: nil)
    }

image

💻 Environment