- Upgrade Images
- Fix Vari
This commit is contained in:
1 parent
091bb39d54
commit
6c0f2bbae5
98 files changed
+290
-89
No files matched your search
@@ -9,7 +9,7 @@
|
||||
#import "TabBarItem.h"
|
||||
#import <PureLayout/PureLayout.h>
|
||||
#import "NSString+HexColor.h"
|
||||
#import <UIButton+BackgroundColor/UIButton+BackgroundColor.h>
|
||||
#import "UIButton+BackgroundColor.h"
|
||||
|
||||
@interface TabBarItem()
|
||||
|
||||
@@ -83,19 +83,12 @@
|
||||
- (void) setHighlightedColor:(UIColor *)highlightedColor {
|
||||
|
||||
_highlightedColor = highlightedColor;
|
||||
|
||||
[_itemButton setBackgroundColor:_highlightedColor forState:UIControlStateHighlighted];
|
||||
}
|
||||
|
||||
- (void) setHighlighted:(BOOL) highlighted {
|
||||
[_itemButton setHighlighted:highlighted];
|
||||
if ([_itemButton isHighlighted]) {
|
||||
|
||||
[_itemButton setBackgroundColor:_highlightedColor];
|
||||
|
||||
}
|
||||
else {
|
||||
[_itemButton setBackgroundColor:[UIColor clearColor]];
|
||||
}
|
||||
|
||||
NSLog(@"%@",[NSNumber numberWithBool:[_itemButton isSelected]]);
|
||||
NSLog(@"%@",[NSNumber numberWithBool:[_itemButton isHighlighted]]);
|
||||
NSLog(@"%@",[NSNumber numberWithBool:[_itemButton isEnabled]]);
|
||||
@@ -103,14 +96,6 @@
|
||||
}
|
||||
|
||||
- (void) itemButtonTapped {
|
||||
if ([_itemButton isHighlighted]) {
|
||||
|
||||
[_itemButton setBackgroundColor:_highlightedColor];
|
||||
}
|
||||
else {
|
||||
[_itemButton setBackgroundColor:[UIColor clearColor]];
|
||||
}
|
||||
|
||||
if (_delegate && [_delegate respondsToSelector:@selector(tabBarItemSelected:)]) {
|
||||
[_delegate tabBarItemSelected:self];
|
||||
}
|
||||
@@ -118,7 +103,7 @@
|
||||
NSLog(@"%@",[NSNumber numberWithBool:[_itemButton isHighlighted]]);
|
||||
NSLog(@"%@",[NSNumber numberWithBool:[_itemButton isEnabled]]);
|
||||
NSLog(@"%ld",_itemButton.state);
|
||||
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.1 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
|
||||
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.002 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
|
||||
[_itemButton setHighlighted:YES];
|
||||
});
|
||||
}
|
||||
|
||||
+15
@@ -0,0 +1,15 @@
|
||||
//
|
||||
// UIButton+BackgroundColor.h
|
||||
// UIButton+BackgroundColor
|
||||
//
|
||||
// Created by Luu Gia Thuy on 7/28/15.
|
||||
// Copyright (c) 2015 Luu Gia Thuy. All rights reserved.
|
||||
//
|
||||
|
||||
#import <UIKit/UIKit.h>
|
||||
|
||||
@interface UIButton (BackgroundColor)
|
||||
|
||||
- (void)setBackgroundColor:(UIColor *)backgroundColor forState:(UIControlState)state UI_APPEARANCE_SELECTOR;
|
||||
|
||||
@end
|
||||
+20
@@ -0,0 +1,20 @@
|
||||
//
|
||||
// UIButton+BackgroundColor.m
|
||||
// UIButton+BackgroundColor
|
||||
//
|
||||
// Created by Luu Gia Thuy on 7/28/15.
|
||||
// Copyright (c) 2015 Luu Gia Thuy. All rights reserved.
|
||||
//
|
||||
|
||||
#import "UIImage+Color.h"
|
||||
#import "UIButton+BackgroundColor.h"
|
||||
|
||||
@implementation UIButton (BackgroundColor)
|
||||
|
||||
- (void)setBackgroundColor:(UIColor *)backgroundColor forState:(UIControlState)state {
|
||||
[self setBackgroundImage:[UIImage imageWithColor:backgroundColor] forState:state];
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
|
||||
+15
@@ -0,0 +1,15 @@
|
||||
//
|
||||
// UIImage+Color.h
|
||||
// UIButton+BackgroundColor
|
||||
//
|
||||
// Created by Luu Gia Thuy on 7/28/15.
|
||||
//
|
||||
//
|
||||
|
||||
#import <UIKit/UIKit.h>
|
||||
|
||||
@interface UIImage (Color)
|
||||
|
||||
+ (UIImage *)imageWithColor:(UIColor *)color;
|
||||
|
||||
@end
|
||||
+27
@@ -0,0 +1,27 @@
|
||||
//
|
||||
// UIImage+Color.m
|
||||
// UIButton+BackgroundColor
|
||||
//
|
||||
// Created by Luu Gia Thuy on 7/28/15.
|
||||
//
|
||||
//
|
||||
|
||||
#import "UIImage+Color.h"
|
||||
|
||||
@implementation UIImage (Color)
|
||||
|
||||
+ (UIImage *)imageWithColor:(UIColor *)color {
|
||||
CGRect rect = CGRectMake(0.0f, 0.0f, 1.0f, 1.0f);
|
||||
UIGraphicsBeginImageContext(rect.size);
|
||||
CGContextRef context = UIGraphicsGetCurrentContext();
|
||||
|
||||
CGContextSetFillColorWithColor(context, [color CGColor]);
|
||||
CGContextFillRect(context, rect);
|
||||
|
||||
UIImage *image = UIGraphicsGetImageFromCurrentImageContext();
|
||||
UIGraphicsEndImageContext();
|
||||
|
||||
return image;
|
||||
}
|
||||
|
||||
@end
|
||||
Reference in new issue
Block a user