Skip to content

Commit 8ad43f8

Browse files
committed
Added method without color param
1 parent e92e22a commit 8ad43f8

2 files changed

Lines changed: 12 additions & 2 deletions

File tree

UIImageView+Letters/UIImageView+Letters.h

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,14 @@
3030
@interface UIImageView (Letters)
3131

3232
/**
33-
Sets the image property of the view to have a background color and initial text
33+
Sets the image property of the view based on initial text. A random background color is automatically generated.
34+
35+
@param string The string used to generate the initials. This should be a user's full name if available
36+
*/
37+
- (void)setImageWithString:(NSString *)string;
38+
39+
/**
40+
Sets the image property of the view based on initial text and a specified background color.
3441
3542
@param string The string used to generate the initials. This should be a user's full name if available
3643
@param color (optional) This optional paramter sets the background of the image. If not provided, a random color will be generated

UIImageView+Letters/UIImageView+Letters.m

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,10 @@
2626

2727
@implementation UIImageView (Letters)
2828

29+
- (void)setImageWithString:(NSString *)string {
30+
[self setImageWithString:string color:nil];
31+
}
32+
2933
- (void)setImageWithString:(NSString *)string color:(UIColor *)color {
3034

3135
//
@@ -102,7 +106,6 @@ - (UIImage *)imageSnapshotFromView:(UIView *)inputView {
102106

103107
CGFloat scale = [UIScreen mainScreen].scale;
104108

105-
// Code attributed to Nick Lockwood on 25/08/2013.
106109
CGSize size = self.bounds.size;
107110
if (self.contentMode == UIViewContentModeScaleToFill ||
108111
self.contentMode == UIViewContentModeScaleAspectFill ||

0 commit comments

Comments
 (0)