我想这样做:图片
在我的故事板中,我将标签如下:
每个标签都是 70Widht 和 20Height
标签命名为:
label1 (position x:20 y:161)
label2 (position x:50 y:161)
label3 (position x:80 y:161)
label4 (position x:110 y:161)
label5 (position x:140 y:161)
label6 (position x:170 y:161)
label7 (position x:200 y:161)
label8 (position x:230 y:161)
label9 (position x:260 y:161)
label10 (position x:290 y:161)
在我的 ViewController.h 中:
@property (strong, nonatomic) IBOutlet UILabel *label1;
@property (strong, nonatomic) IBOutlet UILabel *label2;
@property (strong, nonatomic) IBOutlet UILabel *label3;
@property (strong, nonatomic) IBOutlet UILabel *label4;
@property (strong, nonatomic) IBOutlet UILabel *label5;
@property (strong, nonatomic) IBOutlet UILabel *label6;
@property (strong, nonatomic) IBOutlet UILabel *label7;
@property (strong, nonatomic) IBOutlet UILabel *label8;
@property (strong, nonatomic) IBOutlet UILabel *label9;
@property (strong, nonatomic) IBOutlet UILabel *label10;
在我的 ViewController.m 中的 ViewDidLoad 方法中:
[label1 setTransform:CGAffineTransformMakeRotation(-M_PI / 2)];
[label2 setTransform:CGAffineTransformMakeRotation(-M_PI / 2)];
[label3 setTransform:CGAffineTransformMakeRotation(-M_PI / 2)];
[label4 setTransform:CGAffineTransformMakeRotation(-M_PI / 2)];
[label5 setTransform:CGAffineTransformMakeRotation(-M_PI / 2)];
[label6 setTransform:CGAffineTransformMakeRotation(-M_PI / 2)];
[label7 setTransform:CGAffineTransformMakeRotation(-M_PI / 2)];
[label8 setTransform:CGAffineTransformMakeRotation(-M_PI / 2)];
[label9 setTransform:CGAffineTransformMakeRotation(-M_PI / 2)];
[label10 setTransform:CGAffineTransformMakeRotation(-M_PI / 2)];
但是当我运行模拟器时出了点问题:图片
前五个标签没问题,但其他五个处于随机位置。
我怎么解决这个问题?