Rotate a UIlabel to make it vertical
Try this working code:
UILabel *label = [[UILabel alloc] initWithFrame:CGRectMake(0, 100, 200, 80)];//set background color to see if the frame is rotated[label setBackgroundColor:[UIColor redColor]];[label setText:@"Text Here"];label.transform=CGAffineTransformMakeRotation( ( 90 * M_PI ) / 180 );[self.view addSubview:label];
Hope it helps
If you prefer set the label position and size visually in you xib or storyboard do the following:
Set the labels position and size in the interface builder like you want them to stay after the rotation.
Rotate the label and set the frame again:
-(void)rotateLabel:(UILabel*) label{ CGRect orig = label.frame; label.transform=CGAffineTransformMakeRotation(M_PI * 3/2);//270º label.frame = orig;}
Your Label is a square(w:100,h:100).So your label has transformed, but you can't see the change,because the width is equal to the height.