I would like to have a label that is displayed upside down, when the view did load.
Here is the default code given in the ViewController.swift, and I had also added the UILabel as an outlet.
import UIKit
class ViewController: UIViewController {
@IBOutlet var Label: UILabel!
override func viewDidLoad() {
super.viewDidLoad()
}
override func didReceiveMemoryWarning() {
super.didReceiveMemoryWarning()
}
}
Also sorry if this is a dumb question I am very new to IOS development and swift.
To rotate your label in viewDidLoad just use the following :
Swift
override func viewDidLoad() {
super.viewDidLoad()
var aLabel: UILabel = ...
aLabel.transform = CGAffineTransformMakeRotation(M_PI)
}
Objective C
-(void) viewDidLoad {
[super viewDidLoad];
UILabel *aLabel = ...
aLabel.transform = CGAffineTransformMakeRotation(M_PI);
}
M_PI will make a rotation of 180 degrees which will result in an upside down label.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With