Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Try below code, in this code i've changed my font style and size with <strong>CTFontRef</strong> </p> <pre><code>+(void)drawText:(NSString*)textToDraw inFrame:(CGRect)frameRect { CFStringRef stringRef = ( CFStringRef)textToDraw; CGColorSpaceCreateWithName(stringRef); NSMutableAttributedString *string = [[NSMutableAttributedString alloc] initWithString:textToDraw]; CTFontRef helveticaBold; helveticaBold = CTFontCreateWithName(CFSTR("Helvetica-Bold"), 24.0, NULL); [string addAttribute:(id)kCTFontAttributeName value:(id)helveticaBold range:NSMakeRange(0, [string length])]; [string addAttribute:(id)kCTForegroundColorAttributeName value:(id)[UIColor whiteColor].CGColor range:NSMakeRange(0, [string length])]; CTFramesetterRef framesetter = CTFramesetterCreateWithAttributedString((CFAttributedStringRef)string); CGMutablePathRef framePath = CGPathCreateMutable(); CGPathAddRect(framePath, NULL, frameRect); CFRange currentRange = CFRangeMake(0, 0); CTFrameRef frameRef = CTFramesetterCreateFrame(framesetter, currentRange, framePath, NULL); CGPathRelease(framePath); CGContextRef currentContext = UIGraphicsGetCurrentContext(); CGContextSetTextMatrix(currentContext, CGAffineTransformIdentity); CGContextTranslateCTM(currentContext, 0, frameRect.origin.y*2); CGContextScaleCTM(currentContext, 1.0, -1.0); CTFrameDraw(frameRef, currentContext); CGContextScaleCTM(currentContext, 1.0, -1.0); CGContextTranslateCTM(currentContext, 0, (-1)*frameRect.origin.y*2); CFRelease(frameRef); CFRelease(string); CFRelease(framesetter); } </code></pre> <p>you can follow this Link also <a href="http://www.cocoanetics.com/2011/01/befriending-core-text/" rel="nofollow">Example</a></p> <p>Hope this helps you, Happy Coding</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload