UIButton 点击后变灰

时间:2015-11-25 13:12:13   收藏:0   阅读:233
+(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;
}
 

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

评论(0
© 2014 bubuko.com 版权所有 - 联系我们:wmxa8@hotmail.com
打开技术之扣,分享程序人生!