- Upgrade Images
- Fix Vari
This commit is contained in:
1 parent
091bb39d54
commit
6c0f2bbae5
98 files changed
+290
-89
No files matched your search
+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