ios uibutton怎样去掉高亮透明效果
1个回答
2015-04-04 · 知道合伙人数码行家
可以叫我表哥
知道合伙人数码行家
向TA提问 私信TA
知道合伙人数码行家
采纳数:25897
获赞数:1464984
2010年毕业于北京化工大学北方学院计算机科学与技术专业毕业,学士学位,工程电子技术行业4年从业经验。
向TA提问 私信TA
关注
展开全部
第一种方法:
setAdjustsImageWhenHighlighted // default is YES. if YES, image is drawn darker when highlighted(pressed)
UIButton *priceBtn = [UIButton buttonWithType:UIButtonTypeCustom];
[priceBtn setTag:PRICE_BTN_TAG];
[priceBtn setFrame:CGRectMake(DISTANCE_OF_SCREEN_BORDER, 3, 63, 31.5)];
[priceBtn setBackgroundColor:[UIColor clearColor]];
[priceBtn setImage:[UIImage imageNamed:@"sequence_up_pressed.png"] forState:UIControlStateNormal];
[priceBtn addTarget:self action:@selector(priceBtnClicked:) forControlEvents:UIControlEventTouchUpInside];
[priceBtn setAdjustsImageWhenHighlighted:NO];
相关属性:
@property(nonatomic) BOOL reversesTitleShadowWhenHighlighted;
// default is NO. if YES, shadow reverses to shift between engrave and emboss appearance
@property(nonatomic) BOOL adjustsImageWhenHighlighted; //
default is YES. if YES, image is drawn darker when highlighted(pressed)
@property(nonatomic) BOOL adjustsImageWhenDisabled; //
default is YES. if YES, image is drawn lighter when disabled
@property(nonatomic) BOOL showsTouchWhenHighlighted; //
default is NO. if YES, show a simple feedback (currently a glow) while highlighted
第二种方法:
本群的Misery-iOS-武汉提到了一个巧妙的方法 正常&高亮用相同的图片
[priceBtn setImage:[UIImage imageNamed:@"sequence_up_pressed.png"] forState:UIControlStateNormal];
[priceBtn setImage:[UIImage imageNamed:@"sequence_up_pressed.png"] forState:UIControlStateHighli
setAdjustsImageWhenHighlighted // default is YES. if YES, image is drawn darker when highlighted(pressed)
UIButton *priceBtn = [UIButton buttonWithType:UIButtonTypeCustom];
[priceBtn setTag:PRICE_BTN_TAG];
[priceBtn setFrame:CGRectMake(DISTANCE_OF_SCREEN_BORDER, 3, 63, 31.5)];
[priceBtn setBackgroundColor:[UIColor clearColor]];
[priceBtn setImage:[UIImage imageNamed:@"sequence_up_pressed.png"] forState:UIControlStateNormal];
[priceBtn addTarget:self action:@selector(priceBtnClicked:) forControlEvents:UIControlEventTouchUpInside];
[priceBtn setAdjustsImageWhenHighlighted:NO];
相关属性:
@property(nonatomic) BOOL reversesTitleShadowWhenHighlighted;
// default is NO. if YES, shadow reverses to shift between engrave and emboss appearance
@property(nonatomic) BOOL adjustsImageWhenHighlighted; //
default is YES. if YES, image is drawn darker when highlighted(pressed)
@property(nonatomic) BOOL adjustsImageWhenDisabled; //
default is YES. if YES, image is drawn lighter when disabled
@property(nonatomic) BOOL showsTouchWhenHighlighted; //
default is NO. if YES, show a simple feedback (currently a glow) while highlighted
第二种方法:
本群的Misery-iOS-武汉提到了一个巧妙的方法 正常&高亮用相同的图片
[priceBtn setImage:[UIImage imageNamed:@"sequence_up_pressed.png"] forState:UIControlStateNormal];
[priceBtn setImage:[UIImage imageNamed:@"sequence_up_pressed.png"] forState:UIControlStateHighli
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询