Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
branch: master
Fetching contributors…

Cannot retrieve contributors at this time

executable file 59 lines (40 sloc) 1.043 kB
//
// ColorButton.m
// JMML
//
#import "ColorButton.h"
@implementation ColorButton
@synthesize selected,showCheckmark;
// new default constructor
- (id) init {
self = [super initWithItems:[NSArray arrayWithObject:@""]];
[self setSegmentedControlStyle:UISegmentedControlStyleBar];
showCheckmark = YES;
return self;
}
// color methods that mimic UIButton
-(UIColor *) color {
return [self tintColor];
}
- (void) setColor: (UIColor *) c {
[self setTintColor: c];
}
- (void) drawRect:(CGRect) rect {
[super drawRect:rect];
if (selected && showCheckmark) {
if (checkmark ==nil) {
checkmark = [UIImage imageNamed:@"checkmark.png"];
}
[self setImage:checkmark forSegmentAtIndex:0];
}else{
[self setImage:nil forSegmentAtIndex:0];
}
}
- (void) setSelected:(BOOL)s {
selected = s;
[self setNeedsDisplay];
}
- (BOOL) selected {
return [self selected];
}
@end
Jump to Line
Something went wrong with that request. Please try again.