I'm trying to have an UIButton with an image in the middle of it. I want this button to have edge insets of 10px. When I set these, I have the correct visual result but I can only click in a little area of this button.
How can I have the same visual but be able to click on the whole button ?
Here is my code :
self.descriptionViewMaleButton.setImage(UIImage(icon: "icon-male", backgroundColor: UIColor.whiteColor(), iconColor: UIColor.blackColor(), iconScale: 1.0, andSize: CGSize(width: 50, height: 50)), forState: UIControlState.Normal)
self.descriptionViewMaleButton.layer.borderColor = UIColor.grayColor().CGColor
self.descriptionViewMaleButton.layer.borderWidth = 1.0
self.descriptionViewMaleButton.imageEdgeInsets = UIEdgeInsetsMake(10, 10, 10, 10)
And the visual result :
EDIT : I am able to click on the whole button but it is highlighting only the image.
EDIT : I "fixed" that by implementing the highlighting myself. Anyway, if someones know more about this issue, I would be glad to know about it.