Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- - (UIImage *)drawImage:(UIImage *)profileImage withBadge:(UIImage *)badge withText:(NSString *)count {
- UIGraphicsBeginImageContextWithOptions(profileImage.size, NO, 0.0f);
- [profileImage drawInRect:CGRectMake(0, 0, profileImage.size.width, profileImage.size.height)];
- [badge drawInRect:CGRectMake(profileImage.size.width - badge.size.width, 0, badge.size.width, badge.size.height)];
- UILabel *label = [[UILabel alloc] initWithFrame:CGRectMake(0, 0, badge.size.width, badge.size.height)];
- label.text = count;
- label.textAlignment = NSTextAlignmentCenter;
- label.font = [UIFont systemFontOfSize:11.f];
- label.textColor = [UIColor whiteColor];
- [label drawTextInRect:CGRectMake(profileImage.size.width - badge.size.width, 0, badge.size.width, badge.size.height)];
- UIImage *resultImage = UIGraphicsGetImageFromCurrentImageContext();
- UIGraphicsEndImageContext();
- return resultImage;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement