我能想象的唯一方法是为UIButton定制绘图。因此,为正常状态制作一个.png图像,并为压制的蓝色状态制作一个。因此,为您的按钮创建一个插座和一个动作。还要为您的头文件添加一个BOOL *状态。然后在viewDidLoad
添加以下代码:
[yourButton setBackgroundImage:@"normalimage.png" forState:UIControlStateNormal];
[yourButton setBackgroundImage:@"normalimage.png" forState:UIControlStateHighlited];
state = NO
的行动按钮添加以下代码:
if (state == NO) {
[yourButton setBackgroundImage:@"blueimage.png" forState:UIControlStateNormal];
[yourButton setBackgroundImage:@"blueimage.png" forState:UIControlStateHighlited];
state = YES;
}
else {
[yourButton setBackgroundImage:@"normalimage.png" forState:UIControlStateNormal];
[yourButton setBackgroundImage:@"normalimage.png" forState:UIControlStateHighlited];
state = NO;
}
很简单的东西。我写了这一切的记忆,你真的只是想有点来到这个任何想法....
好吧,我放弃了...我会使用标准(你)的方法:) – Alex1987