File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 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
Original file line number Diff line number Diff line change 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 ||
You can’t perform that action at this time.
0 commit comments