0
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}];
我的代碼適用於打印高分,但是我的當前應用是橫向而非縱向,所以文本以90度角顯示。有沒有辦法解決這個問題(不需要切換到標籤,因爲這需要很多改變)?在iOS中將文本旋轉90度