How can i convert view to landscape inside portrait device orientation
My View controller Code.
import UIKit
class SampleViewController: UIViewController {
var commingtextview:String = ""
@IBOutlet weak var textview: UITextView!
override func viewDidLoad() {
super.viewDidLoad()
navigationController!.navigationBar.barTintColor = UIColorFromRGBs(0x000000)
navigationController!.navigationBar.tintColor = UIColor.whiteColor();
textview.text = self.commingtextview
}
override func didReceiveMemoryWarning() {
super.didReceiveMemoryWarning()
// Dispose of any resources that can be recreated.
}
}
Important !
My project portrait must be portrait i want to change only this view orientation to landscape.
Also my project orientation
[x] Portrait
[ ] Upside Down
[ ] Landscape Left
[ ] Landscape Right
Use :-
override func viewWillAppear(animated: Bool) {
super.viewWillAppear(animated)
self.view.transform = CGAffineTransformMakeRotation(CGFloat(M_PI_2))
// Set whatever frame you want
// self.view.frame = CGRectMake(xOrigin,yOrigin,Width,Height)
}
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.