Solve the problem of UIButton backgroundImage stretching

UIImage *bgImage = [UIImage imageNamed:@"health_ranking"];
bgImage = [bgImage stretchableImageWithLeftCapWidth:bgImage.size.width/2 topCapHeight:bgImage.size.height/2];
[button setBackgroundImage:bgImage forState:UIControlStateNormal];

Stretch where the picture can be stretched

Guess you like

Origin blog.csdn.net/qq_28285625/article/details/104775349