Skip to content

Commit 373a0a4

Browse files
author
Stephanie Sharp
committed
Tidy up UIImage+MFTint category
1 parent ab90df4 commit 373a0a4

2 files changed

Lines changed: 7 additions & 11 deletions

File tree

MaterialTextField/UIImage+MFTint.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,9 @@
55
// Created by Steph Sharp on 6/08/2015.
66
// Copyright (c) 2015 Stephanie Sharp. All rights reserved.
77
//
8+
// With thanks to Gordon Fontenot from thoughtbot:
9+
// https://robots.thoughtbot.com/designing-for-ios-blending-modes
10+
//
811

912
#import <UIKit/UIKit.h>
1013

MaterialTextField/UIImage+MFTint.m

Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -5,28 +5,21 @@
55
// Created by Steph Sharp on 6/08/2015.
66
// Copyright (c) 2015 Stephanie Sharp. All rights reserved.
77
//
8+
// With thanks to Gordon Fontenot from thoughtbot:
9+
// https://robots.thoughtbot.com/designing-for-ios-blending-modes
10+
//
811

912
#import "UIImage+MFTint.h"
1013

1114
@implementation UIImage (MFTint)
1215

1316
- (UIImage *)mf_tintedImageWithColor:(UIColor *)tintColor
14-
{
15-
return [self tintedImageWithColor:tintColor blendingMode:kCGBlendModeDestinationIn];
16-
}
17-
18-
#pragma mark - Private methods
19-
20-
- (UIImage *)tintedImageWithColor:(UIColor *)tintColor blendingMode:(CGBlendMode)blendMode
2117
{
2218
UIGraphicsBeginImageContextWithOptions(self.size, NO, 0.0f);
2319
[tintColor setFill];
2420
CGRect bounds = CGRectMake(0, 0, self.size.width, self.size.height);
2521
UIRectFill(bounds);
26-
[self drawInRect:bounds blendMode:blendMode alpha:1.0f];
27-
28-
if (blendMode != kCGBlendModeDestinationIn)
29-
[self drawInRect:bounds blendMode:kCGBlendModeDestinationIn alpha:1.0];
22+
[self drawInRect:bounds blendMode:kCGBlendModeDestinationIn alpha:1.0f];
3023

3124
UIImage *tintedImage = UIGraphicsGetImageFromCurrentImageContext();
3225
UIGraphicsEndImageContext();

0 commit comments

Comments
 (0)