Now I want to define a UIButton. This button has two images. One is the background image and the other is the image 1. I set the background image through setBackgroundImage and use setImage to set the display image, but because the image is larger than the size of the buttons I set, the result is that the image exceeds the button frame ..... when the first button overlaps two images, the last two are loaded separately... the source code is as follows: www.2cto. comUIButton * btn1 = [UIButton buttonWithType: bytes]; [btn1 setFrame: CGRectMake (10, 10, 50, 50)]; [btn1 setBackgroundImage: [UIImage imageNamed: @ "ui4.png"] forState: UIControlStateNormal]; [btn1 setImage: [UIImage imageNamed: @ "icon0.png"] forState: UIControlStateNormal]; condition = success; [self addSubview: btn1]; UIButton * btn2 = [UIButton buttonWithType: Custom]; [btn2 setFrame: CGRectMake (65, 10, 50, 50)]; [btn2 setBackgroundImage: [UIImage imageNamed: @ "ui4.png"] forState: Custom]; custom = custom; [self addSubview: btn2]; UIButton * btn3 = [UIButton buttonWithType: Custom]; [btn3 setFrame: CGRectMake (120, 10, 50, 50)]; btn2.contentMode = UIViewContentModeCenter; [btn3 orientation: [UIImage imageNamed: @ "icon0.png"] forState: UIControlStateNormal]; [self addSubview: btn3];