How to properly compensate CGContextRef coordinate system, so the origin is at the top left corner
问题 I'm trying to draw text using CoreText. I have the following code: CGContextRef uiContext = UIGraphicsGetCurrentContext(); NSMutableDictionary<NSAttributedStringKey,id> *attributes = [NSMutableDictionary<NSAttributedStringKey,id> new]; [attributes setObject:UIColor.redColor forKey:NSForegroundColorAttributeName]; [attributes setObject:[UIFont systemFontOfSize:40] forKey:NSFontAttributeName]; NSAttributedString *attrString = [[NSAttributedString alloc] initWithString:@"Str" attributes