2009-12-23 101 views
2

有什麼好方法可以將UIImagePicker設置爲風景取向嗎?我試着打電話給setStatusBarOrientationpresentModalViewController像下面後,iPhone UIImagePicker相機在風景方向

[self presentModalViewController:picker animated:YES]; 

[[UIApplication sharedApplication] setStatusBarOrientation: UIInterfaceOrientationLandscapeRight animated: NO ]; 

但是,視頻時長視圖(00:00)右側角球沒有旋轉,方向改變。

回答

4

不幸的是,根據documentation,圖像選擇器只支持肖像模式。

1

Apple不支持相機視圖的橫向。如果您想要顯示爲自定義的任何內容,請在其上添加重疊視圖&將該視圖轉換爲橫向視圖。 @注意:-overlay也作爲肖像添加爲什麼需要轉換。

1

我可以使用下面的代碼來創建景觀相機視圖:

[self.view insertSubview:self.imagePicker.view atIndex:0]; 

self.imagePicker.view.transform = 
    CGAffineTransformScale (
          CGAffineTransformTranslate(
          CGAffineTransformMakeRotation(M_PI/2), -90, -15), 
          1.2,1.2) 
          ; 

注意,我直接添加imagePicker的查看到當前視圖,而不是調用它作爲一個模式。

self.imagePicker.view.transform似乎對預期的所有CGAffineTransform函數調用做出了響應,儘管我無法確定Apple是否認可這種方法。