Skip to content

PopMenuDefaultAction.iconWidthHeight is a static property #9

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
shalyf opened this issue Jul 5, 2018 · 4 comments
Closed

PopMenuDefaultAction.iconWidthHeight is a static property #9

shalyf opened this issue Jul 5, 2018 · 4 comments
Assignees
Labels
enhancement New feature or request

Comments

@shalyf
Copy link

shalyf commented Jul 5, 2018

This is a cool popup menu, I like it, and I will use it in my project.
But when I add my icon image(size 18 pixel) to PopMenuDefaultAction, It looks ugly. The image is much bigger than I expected. So I looked at the source code and found a problem.

PopMenuDefaultAction.iconWidthHeight is a static property, I think it should be automatically calculated.

NSLayoutConstraint.activate([
                iconImageView.widthAnchor.constraint(equalToConstant: PopMenuDefaultAction.iconWidthHeight),
                iconImageView.heightAnchor.constraint(equalTo: iconImageView.widthAnchor),
                iconImageView.leadingAnchor.constraint(equalTo: view.leadingAnchor, constant: PopMenuDefaultAction.iconLeftPadding),
                iconImageView.centerYAnchor.constraint(equalTo: view.centerYAnchor)
            ])

iconImageView.widthAnchor and iconImageView.heightAnchor should be automatically calculated based on the size of the image.

Now I am using a custom PopMenuAction named PopMenuCustomAction and modifying PopMenuDefaultAction.iconWidthHeight to 18 to resolve my problem.

Please fix this issue, Thanks.

@CaliCastle CaliCastle self-assigned this Jul 5, 2018
@CaliCastle CaliCastle added the enhancement New feature or request label Jul 5, 2018
@CaliCastle
Copy link
Owner

Hi!

Thanks for finding this issue! I was initially going to make this become a variable that's modifiable but forgot along the way.

This will be resolved in the upcoming patch (v1.1.3)

@CaliCastle
Copy link
Owner

simulator screen shot - iphone x - 2018-09-02 at 23 26 26

It'll be added to PopMenuDefaultAction and you can directly configure it like:

let action = PopMenuDefaultAction(title: "Some Title", image: UIImage(named: "blah"), color: .gray)
action.iconWidthHeight = 45

@shalyf
Copy link
Author

shalyf commented Sep 3, 2018

@CaliCastle Thanks.

@CaliCastle
Copy link
Owner

Hi @shalyf,

The suggested enhancement is completed in v2.1.1, let me know if there's any issue or bug, thanks again!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants