Created
August 2, 2012 13:59
-
-
Save pita5/3237297 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@interface __PLGBorderTopButton : UIView | |
@property (nonatomic) PLGColor selectedColor; | |
@property (nonatomic) UIButton* button; | |
@end | |
@implementation __PLGBorderTopButton | |
- (id)forwardingTargetForSelector:(SEL)aSelector | |
{ | |
return _button; | |
} | |
- (void)tapped | |
{ | |
self.backgroundColor = [PLGTheme colorWithColor:_selectedColor]; | |
} | |
- (void)layoutSubviews | |
{ | |
CGRect f = self.frame; | |
CGFloat height = f.size.height-5; | |
CGFloat width = f.size.width; | |
_button.frame = CGRectMake(0, 5, width, height); | |
} | |
- (id)initWithColor:(PLGColor)color topColor:(PLGColor)topColor | |
{ | |
self = [super initWithFrame:CGRectMake(0, 0, 100, 44.0f)]; | |
if (self) | |
{ | |
_button = [PLGTheme buttonWithColor:color]; | |
[_button addObserver:self forKeyPath:@"state" options:NSKeyValueObservingOptionNew|NSKeyValueObservingOptionOld context:NULL]; | |
[self addSubview:_button]; | |
_selectedColor = topColor; | |
self.backgroundColor = [PLGTheme colorWithColor:PLGWhite]; | |
} | |
return self; | |
} | |
@end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment