MortimerGoro / MGSwipeTableCell

An easy to use UITableViewCell subclass that allows to display swippable buttons with a variety of transitions.
MIT License
6.96k stars 1.07k forks source link

Changing size of icons for buttons? #293

Open seanbarney opened 7 years ago

seanbarney commented 7 years ago

Is there a way to define the size of the icon images? I am currently using imageEdgeInsets to make the icons smaller, but I find the result to be inconsistent -- sometimes they are small, and sometimes they become larger.

Here is a sample of the current implementation:

let profileButton = MGSwipeButton(title: "", icon: #imageLiteral(resourceName: "followIcon"), backgroundColor: UIColor(hex: "31cf73")) { (sender: MGSwipeTableCell!) -> Bool in
            self.hideAddRowOptions()
            self.selectedIndexPath = nil
            // Perform some setup
            return true
        }

var iconImageInsets: UIEdgeInsets = UIEdgeInsetsMake(25.0, 25.0, 25.0, 25.0)

profileButton.imageEdgeInsets = iconImageInsets

And attached are examples of the inconsistent result. (The smaller icon is the preferred result.)

img_4816 img_4814

I would also like to define the size directly as my cells are "expandable" and in their expanded state, the icons grow proportionally to the size of the cell (since they are using imageEdgeInsets) but I would prefer them to stay consistent in all states. Here's an example of what I currently get:

img_4818