[touristBtn setBackgroundColor:[UIColor clearColor]];
[touristBtn setImage:[UIImage imageNamed:@"firstBtnpng"] forState:UIControlStateNormal];
[touristBtn setImage:[UIImage imageNamed:@"secondBtnpng" forState:UIControlStateSelected];
[touristBtn addTarget:self action:@selector(touristEvent:) forControlEvents:UIControlEventTouchUpInside];
[tabView addSubview:touristBtn];
在button的action方法中改变button的状态:
-(void)touristEvent:(id)sender{
UIButton button = (UIButton )sender;
buttonselected = !buttonselected;
}谢谢。
不过其实我的是类似合图的:因此要用ugui中设置texture
type为sprite(2d
and
ui),这样才能有sprite
mode为mutiple来进行切图。
不知道对于这种方式黑色背景的素材如何转变成透明的背景的。
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)