Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/ios/113.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
在iOS中将文本旋转90度_Ios_Rotation_Nsstring_Landscape - Fatal编程技术网

在iOS中将文本旋转90度

在iOS中将文本旋转90度,ios,rotation,nsstring,landscape,Ios,Rotation,Nsstring,Landscape,我的代码用于打印高分,但我当前的应用程序是横向的,而不是纵向的,因此文本以90度角显示。有没有办法在不切换到标签的情况下修复此问题,因为这需要进行大量更改?您是否尝试使用查看当前文本矩阵的外观?文本矩阵连接到当前变换矩阵。也许它有你不想要的价值 NSString *strFromInt = [NSString stringWithFormat:@"%d",score]; NSString *strFromInt2 = [NSString stringWithFormat:@"%ld"

我的代码用于打印高分,但我当前的应用程序是横向的,而不是纵向的,因此文本以90度角显示。有没有办法在不切换到标签的情况下修复此问题,因为这需要进行大量更改?

您是否尝试使用查看当前文本矩阵的外观?文本矩阵连接到当前变换矩阵。也许它有你不想要的价值

  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}];