UIButton background image resize, uibutton background image
Generally, the button adds a background image.
UIButton * button = [[UIButton alloc] initWithFrame: CGRectMake (60,100,)];
[Button setTitle: @ "Test Button" forState: UIControlStateNormal]; // Image with without cap insets
UIImage * buttonImage = [UIImage imageNamed: @ "blueButton"];
[Button addTarget: self action: @ selector (buttonPressed :) forControlEvents: UIControlEventTouchUpInside];
[Button setBackgroundImage: buttonImage forState: UIControlStateNormal];
[[Self view] addSubview: button];
If the size of the background image does not match that of the button frame. If the size of the frame is greater than the size of the background image, the system will automatically raise the image.
The result is that the image is enlarged, causing deformation. (This is not what we expected. If you have a good artist and want to provide any graph, you can ignore the following method)
Modify the above uiimage creation as follows:
UIImage * buttonImage = [UIImage imageNamed: @ "blueButton"] resizableImageWithCapInsets: UIEdgeInsetMake (,)];