在我的项目中,我想做一个垂直按钮,文本也是垂直的,,,有人帮忙吗?!
完全一样的东西
Use this code to rotate the button
btn.transform = CGAffineTransformMakeRotation(-M_PI / 2);
And
btn.transform = CGAffineTransformMakeRotation(M_PI / 2);
You can instead rotate a button by using :
yrButton.transform = CGAffineTransformMakeRotation(90.0*M_PI/180.0);
This will give you 90 Degree rorate.
try like this i hope it'l helps you,
btn.transform= CGAffineTransformMakeRotation(DEGREES_TO_RADIANS(270));
and define
#define DEGREES_TO_RADIANS(x) (M_PI * x / 180.0)
You can use CGAffineTransform for this purpose, it does the rotation according to your choice
您可以通过转换来实现这一点。
顺时针旋转:
button.transform = CGAffineTransformMakeRotation(90.0*M_PI/180.0);
和逆时针:
button.transform = CGAffineTransformMakeRotation(-90.0*M_PI/180.0);
第一个数字(90.0 或 -90.0)指定旋转按钮的角度(以度为单位)。