- 需要設(shè)置 setImage 設(shè)置setbackgroundImage 不管用
moreButton.setImage(IMAGE("comcard_icon_more_normal"), forState: .Normal)
- 設(shè)置button的contentmode
moreButton.contentMode = .Center
- 設(shè)置對應(yīng)更大的frame或者約束就可以了.
原frame: moreButton.frame = CGRectMake(4, 8, 44, 28)
新frame: moreButton.frame = CGRectMake(0, 0, 48, 44)
展示效果一樣
原理: 擴(kuò)大button的frame,并且將圖片設(shè)置成居中.