[英]How to not to rotate a certain UIView allowing UIViewController's rotation
有誰知道通過允許UIViewController旋轉來修復(不旋轉)某個UIView?
我想實現像相機應用程序用戶界面這樣的界面。 顯示攝像機視圖的視圖不會旋轉,但HUD(如按鈕)會旋轉。
您可以將變換應用於不想旋轉的視圖。
使用以下方法進行操作。
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
if(interfaceOrientation == UIInterfaceOrientationLandscapeRight)
{
view.transform = CGAffineTransformMakeRotation(-M_PI/2);
}
else if(interfaceOrientation == UIInterfaceOrientationLandscapeLeft)
{
view.transform = CGAffineTransformMakeRotation(M_PI/2);
}
return YES;
}
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.