草庐IT

startTrainingBtn

全部标签

ios - UIButton 的剪辑图像

我有一个使用图像显示的UIButton。问题是我的图像是109x78,但我希望按钮的大小为109x20,固定在左上角并剪裁大于20像素高的所有内容。这是我现在拥有的:UIButton*startTrainingBtn=[UIButtonbuttonWithType:UIButtonTypeCustom];[startTrainingBtnsetContentMode:UIViewContentModeTopLeft];[startTrainingBtnsetClipsToBounds:YES];[startTrainingBtnsetImage:[UIImageimageNamed:@