Question

How have white font with black border?

without use his own font! is it possible?

like here -> http://i.stack.imgur.com/ohPQZ.gif

Was it helpful?

Solution

What you want can be achieved by Quartz 2D. You can take a look at this Sample Code given by Apple. You can read the Documentation also.

Select the font :

UIFont *font =  [UIFont fontWithName:@"Arial" size:14];
CGPoint point = CGPointMake(0,0);

Get the current Context :

CGContextRef context = UIGraphicsGetCurrentContext();

Set Fill Color and Stroke Color :

CGContextSetRGBFillColor(context, [[UIColor whiteColor] CGColor]);
CGContextSetRGBStrokeColor(context, [[UIColor blackColor] CGColor]);

Set Text Drawing Mode :

CGContextSetTextDrawingMode(context, kCGTextFillStroke);

Save State :

CGContextSaveGState(context);
[@"White Font With Black Border?" drawAtPoint:point withFont:font];
CGContextRestoreGState(context);
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top