This file contains 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
-(UIImage *)imageWithTint:(UIImage *)image andTintColor:(UIColor *)tintColor { | |
UIImage *imageNew = [image imageWithRenderingMode:UIImageRenderingModeAlwaysTemplate]; | |
UIImageView *imageView = [[UIImageView alloc] initWithImage:imageNew]; | |
imageView.tintColor = tintColor; | |
UIGraphicsBeginImageContextWithOptions(imageView.bounds.size, NO, 0.0); | |
[imageView.layer renderInContext:UIGraphicsGetCurrentContext()]; | |
UIImage *tintedImage = UIGraphicsGetImageFromCurrentImageContext(); | |
UIGraphicsEndImageContext(); | |
This file contains 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
-(UIImage *)invertedImageWithColor:(UIColor*)color { | |
UIGraphicsBeginImageContextWithOptions(self.size, NO, 0.0); | |
CGContextRef context = UIGraphicsGetCurrentContext(); | |
CGRect contextRect = CGContextGetClipBoundingBox(context); | |
CGContextSetFillColorWithColor(context, [color CGColor]); | |
CGContextFillRect(context, contextRect); | |
[self drawInRect:contextRect blendMode:kCGBlendModeDestinationOut alpha:1.0]; |
This file contains 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
import Foundation | |
import UIKit | |
public extension UIView { | |
func roundCornerWithShadow(cornerRadius: CGFloat, shadowRadius: CGFloat, offsetX: CGFloat, offsetY: CGFloat, colour: UIColor, opacity: Float) { | |
self.clipsToBounds = false |