我有自定义按钮,带有我想在按钮内向下移动的图像。我不想弄乱按钮的可点击部分,而只想移动图像。我试过调整 button.imageview.frame,但它似乎没有做任何事情。
这是我的代码:
UIButton *button = [UIButton buttonWithType:UIButtonTypeCustom];
button.frame = CGRectMake(0.0, 0.0, 25.0, 25.0);
UIImage *buttonOnImage = [@"tabbar_icon_0"];
[button setImage:buttonOnImage forState:UIControlStateHighlighted];
[button setImage:buttonOnImage forState:UIControlStateSelected];