在iOS中将文本旋转90度
我的代码用于打印高分,但我当前的应用程序是横向的,而不是纵向的,因此文本以90度角显示。有没有办法在不切换到标签的情况下修复此问题,因为这需要进行大量更改?您是否尝试使用查看当前文本矩阵的外观?文本矩阵连接到当前变换矩阵。也许它有你不想要的价值在iOS中将文本旋转90度,ios,rotation,nsstring,landscape,Ios,Rotation,Nsstring,Landscape,我的代码用于打印高分,但我当前的应用程序是横向的,而不是纵向的,因此文本以90度角显示。有没有办法在不切换到标签的情况下修复此问题,因为这需要进行大量更改?您是否尝试使用查看当前文本矩阵的外观?文本矩阵连接到当前变换矩阵。也许它有你不想要的价值 NSString *strFromInt = [NSString stringWithFormat:@"%d",score]; NSString *strFromInt2 = [NSString stringWithFormat:@"%ld"
NSString *strFromInt = [NSString stringWithFormat:@"%d",score];
NSString *strFromInt2 = [NSString stringWithFormat:@"%ld",(long)highscore];
CGContextRef gc = UIGraphicsGetCurrentContext();
CGContextSetRGBFillColor(gc, 0, 0, 0, 1);
UIFont *uif = [UIFont systemFontOfSize:32];
NSString *combind = [NSString stringWithFormat:@"%@%@%@%@", str, strFromInt, str2, strFromInt2];
CGContextRef context = UIGraphicsGetCurrentContext();
CGContextSaveGState(context);
CGContextRotateCTM(context, -(M_PI/2));
CGContextRestoreGState(context);
[combind drawAtPoint:CGPointMake(100, 100) withAttributes:@{NSFontAttributeName:uif}];