码迷,mamicode.com
首页 > 其他好文 > 详细

UIButton 点击后变灰

时间:2015-11-25 13:14:02      阅读:165      评论:0      收藏:0      [点我收藏+]

标签:

+(UIButton *)getBlueButtonWithTitle:(NSString *)aTitle{
    UIButton *button = [UIButton buttonWithType:UIButtonTypeCustom];
   //要使用系统的变灰,只需设置BackgroundImage即可
    [button setBackgroundImage:[UIImage imageNamed:@"blue.png"] forState:UIControlStateNormal];
    [button setTitle:aTitle forState:UIControlStateNormal];
  //变化后标题的颜色设置需设置状态为UIControlStateHighlighted
    [button setTitleColor:[UIColor lightGrayColor] forState:UIControlStateHighlighted];
    button.layer.cornerRadius = 5;
    button.layer.masksToBounds = YES;
    return button;
}
 

UIButton 点击后变灰

标签:

原文地址:http://www.cnblogs.com/yqlog/p/4994137.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!