[英]Swift How can i convert view to landscape , inside portrait device orientation? It is possible?
How can i convert view to landscape inside portrait device orientation 如何在人像设备方向内将视图转换为横向
My View controller Code. 我的View控制器代码。
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 [x]肖像
[ ] 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)
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.