Created
April 6, 2015 03:31
-
-
Save wisaruthk/0ffb6bf86bb941a4e2ef to your computer and use it in GitHub Desktop.
Cell with customize cell image
This file contains hidden or 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
CGRect mybounds = CGRectMake(0, 0, 20, 20); | |
UIGraphicsBeginImageContext( mybounds.size ); | |
CGContextRef context = UIGraphicsGetCurrentContext(); | |
CIColor *itemColor = [CIColor colorWithString:item.color]; | |
CGContextSetFillColorWithColor(context, [[UIColor colorWithCIColor:itemColor] CGColor]); | |
CGContextFillRect(context, mybounds); | |
UIImage *finalImage = UIGraphicsGetImageFromCurrentImageContext(); | |
UIGraphicsEndImageContext(); | |
cell.imageView.image = finalImage; | |
cell.imageView.layer.cornerRadius = mybounds.size.height/2.0f; | |
cell.imageView.clipsToBounds = YES; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment