Search Results

Search found 5 results on 1 pages for 'user297535'.

Page 1/1 | 1 

  • How can we change color of a text programmatically ?

    - by user297535
    My code is -(UIImage *)addText:(UIImage *)img text:(NSString *)text1{ int w = img.size.width; int h = img.size.height; CGColorSpaceRef colorSpace = CGColorSpaceCreateDeviceRGB(); CGContextRef context = CGBitmapContextCreate(NULL, w, h, 8, 4 * w, colorSpace, kCGImageAlphaPremultipliedFirst); CGContextDrawImage(context, CGRectMake(0, 0, w, h), img.CGImage); CGContextSetRGBFillColor(context, 0.0, 0.0, 1.0, 1); char* text = (char *)[text1 cStringUsingEncoding:NSASCIIStringEncoding]; CGContextSelectFont(context, "Arial", 18, kCGEncodingMacRoman); CGContextSetTextDrawingMode(context, kCGTextFill); CGContextSetRGBFillColor(context, 255, 255, 255, 2); CGContextShowTextAtPoint(context, 10, 170, text, strlen(text)); CGImageRef imageMasked = CGBitmapContextCreateImage(context); CGContextRelease(context); CGColorSpaceRelease(colorSpace); return [UIImage imageWithCGImage:imageMasked]; } -(UIImage *)addText:(UIImage *)img text:(NSString *)text1{ int w = img.size.width; int h = img.size.height; CGColorSpaceRef colorSpace = CGColorSpaceCreateDeviceRGB(); CGContextRef context = CGBitmapContextCreate(NULL, w, h, 8, 4 * w, colorSpace, kCGImageAlphaPremultipliedFirst); CGContextDrawImage(context, CGRectMake(0, 0, w, h), img.CGImage); CGContextSetRGBFillColor(context, 0.0, 0.0, 1.0, 1); char* text = (char *)[text1 cStringUsingEncoding:NSASCIIStringEncoding]; CGContextSelectFont(context, "Arial", 18, kCGEncodingMacRoman); CGContextSetTextDrawingMode(context, kCGTextFill); CGContextSetRGBFillColor(context, 255, 255, 255, 2); CGContextShowTextAtPoint(context, 10, 170, text, strlen(text)); CGImageRef imageMasked = CGBitmapContextCreateImage(context); CGContextRelease(context); CGColorSpaceRelease(colorSpace); return [UIImage imageWithCGImage:imageMasked]; } How can we change the color of the text programmatically? Answers will be greatly appreciated!

    Read the article

  • Is memory leak caused by global variables?

    - by user297535
    When I checked my application for memory leaks it is showing 12 leaks. What will be the effect of this? I used global variables as shown below #import "file1.m" int num; #import "file2.m" extern int num; num = 10; Can this cause memory leaks? Anyone please help. I am a beginner in programming.

    Read the article

1