拖線拿到按鈕者吁,只設(shè)置一次就好,awakeFromNib,點屬性currentBackgroundImage茄蚯,獲取到當前的背景圖片茂浮,處理拉伸,重新給button設(shè)置處理后的拉伸圖片
被拉伸返干,注意四個角
處理后
-(void)awakeFromNib
{
[super awakeFromNib];
UIImage *image = _loginRegisterButton.currentBackgroundImage;
image = [image stretchableImageWithLeftCapWidth:image.size.width * 0.5 topCapHeight:image.size.height * 0.5];
[_loginRegisterButton setBackgroundImage:image forState:UIControlStateNormal];
}