1

I'm using this code to create a filled rectangle with text and adding it to an image

CGRect textRect = CGRectMake(0, p_point.y, p_image.size.width+15, p_image.size.height+10)    
[[UIColor colorWithRed:(70/255.0) green:(70/255.0) blue:(70/255.0) alpha:1] set];
CGContextFillRect(UIGraphicsGetCurrentContext(), textRect);
[[UIColor whiteColor] set];
[p_text drawInRect:textRect withFont:font lineBreakMode:NSLineBreakByTruncatingTail alignment:NSTextAlignmentCenter];
UIImage *newImage = UIGraphicsGetImageFromCurrentImageContext();

i wish the rectangle will have round corners...

liv a
  • 3,232
  • 6
  • 35
  • 76
  • Possible Duplicate : http://stackoverflow.com/questions/2835448/how-to-draw-a-rounded-rectangle-in-core-graphics-quartz-2d – Akshat Singhal Mar 04 '14 at 10:13
  • @AkshatSinghal, I've seen that answer but not sure how it goes with mine since i don't have a UIBezierPath and not sure how it will be captured in UIGraphicsGetImageFromCurrentImageContext, if you are sure it's the solution, can you please answer the question and integrate the code with mine...thanks! – liv a Mar 04 '14 at 10:18

0 Answers0