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

给NSButton设置highlight image

时间:2015-12-16 18:51:12      阅读:214      评论:0      收藏:0      [点我收藏+]

标签:

@property (strong) NSButton *shuffleButton;

     self.shuffleButton = [[NSButton alloc] initWithFrame:CGRectMake(0, 0, 25, 14)];
        self.shuffleButton.bordered = NO;
        [self.shuffleButton setButtonType:NSMomentaryChangeButton];
        [self.shuffleButton setBezelStyle:NSDisclosureBezelStyle];
        [self.shuffleButton setImagePosition:NSImageOnly];
        [self.shuffleButton setImage:[NSImage imageNamed:@"shuffle"]];
        [self.shuffleButton setAlternateImage:[NSImage imageNamed:@"shuffle_highlight"]];
        [self.shuffleButton setTarget:self];
        [self.shuffleButton setAction:@selector(shuffleButtonAction:)];

 shuffle 是normal状态下的image

shuffle_highlight 是按下状态的image

给NSButton设置highlight image

标签:

原文地址:http://www.cnblogs.com/Jackie88N/p/5051609.html

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