IOS-带黑色边框的白色字体?

IOS-带黑色边框的白色字体?,ios,border,uifont,Ios,Border,Uifont,白色字体加黑色边框怎么样 不用自己的字体!可能吗 就像这里->您想要的东西可以通过Quartz 2D实现。你可以看看苹果公司给出的这个。你也可以读这本书 选择字体: UIFont *font = [UIFont fontWithName:@"Arial" size:14]; CGPoint point = CGPointMake(0,0); CGContextRef context = UIGraphicsGetCurrentContext(); CGContextSetRGBFillCo

白色字体加黑色边框怎么样

不用自己的字体!可能吗


就像这里->

您想要的东西可以通过
Quartz 2D
实现。你可以看看苹果公司给出的这个。你也可以读这本书

选择字体:

UIFont *font =  [UIFont fontWithName:@"Arial" size:14];
CGPoint point = CGPointMake(0,0);
CGContextRef context = UIGraphicsGetCurrentContext();
CGContextSetRGBFillColor(context, [[UIColor whiteColor] CGColor]);
CGContextSetRGBStrokeColor(context, [[UIColor blackColor] CGColor]);
CGContextSetTextDrawingMode(context, kCGTextFillStroke);
CGContextSaveGState(context);
[@"White Font With Black Border?" drawAtPoint:point withFont:font];
CGContextRestoreGState(context);
获取当前上下文:

UIFont *font =  [UIFont fontWithName:@"Arial" size:14];
CGPoint point = CGPointMake(0,0);
CGContextRef context = UIGraphicsGetCurrentContext();
CGContextSetRGBFillColor(context, [[UIColor whiteColor] CGColor]);
CGContextSetRGBStrokeColor(context, [[UIColor blackColor] CGColor]);
CGContextSetTextDrawingMode(context, kCGTextFillStroke);
CGContextSaveGState(context);
[@"White Font With Black Border?" drawAtPoint:point withFont:font];
CGContextRestoreGState(context);
设置填充颜色和笔划颜色:

UIFont *font =  [UIFont fontWithName:@"Arial" size:14];
CGPoint point = CGPointMake(0,0);
CGContextRef context = UIGraphicsGetCurrentContext();
CGContextSetRGBFillColor(context, [[UIColor whiteColor] CGColor]);
CGContextSetRGBStrokeColor(context, [[UIColor blackColor] CGColor]);
CGContextSetTextDrawingMode(context, kCGTextFillStroke);
CGContextSaveGState(context);
[@"White Font With Black Border?" drawAtPoint:point withFont:font];
CGContextRestoreGState(context);
设置文本绘制模式:

UIFont *font =  [UIFont fontWithName:@"Arial" size:14];
CGPoint point = CGPointMake(0,0);
CGContextRef context = UIGraphicsGetCurrentContext();
CGContextSetRGBFillColor(context, [[UIColor whiteColor] CGColor]);
CGContextSetRGBStrokeColor(context, [[UIColor blackColor] CGColor]);
CGContextSetTextDrawingMode(context, kCGTextFillStroke);
CGContextSaveGState(context);
[@"White Font With Black Border?" drawAtPoint:point withFont:font];
CGContextRestoreGState(context);
保存状态:

UIFont *font =  [UIFont fontWithName:@"Arial" size:14];
CGPoint point = CGPointMake(0,0);
CGContextRef context = UIGraphicsGetCurrentContext();
CGContextSetRGBFillColor(context, [[UIColor whiteColor] CGColor]);
CGContextSetRGBStrokeColor(context, [[UIColor blackColor] CGColor]);
CGContextSetTextDrawingMode(context, kCGTextFillStroke);
CGContextSaveGState(context);
[@"White Font With Black Border?" drawAtPoint:point withFont:font];
CGContextRestoreGState(context);