iPad:示例項目AVCapture:如何旋轉不同方向的視頻預覽?iPad:示例項目AVCapture:旋轉不同方向的視頻預覽?
2
A
回答
1
如果您想採取簡單的方式,除UIInterfaceOrientation之外不支持任何方向,並且圖像將被正確顯示。
否則,您必須在您的willAnimateRotationToInterfaceOrientation:duration:
方法中將翻譯應用到與預覽層相反的預覽層。例如,UIInterfaceOrientationLandscapeLeft是(IIRC)順時針旋轉90°。因此,將90°逆時針旋轉應用於預覽圖層以進行補償。
0
這是我用:
- (void)willAnimateRotationToInterfaceOrientation: (UIInterfaceOrientation)toInterfaceOrientation duration:(NSTimeInterval)duration
{
[CATransaction begin];
self.prevLayer.orientation = toInterfaceOrientation; //AVCaptureVideoPreviewLayer
self.prevLayer.frame = self.view.frame;
[CATransaction commit];
[super willAnimateRotationToInterfaceOrientation:toInterfaceOrientation duration:duration];
}
相關問題
- 1. 在不同視圖上旋轉IPad屏幕方向
- 2. 以編程方式更改視圖方向而不旋轉ipad
- 3. iPad視圖不旋轉
- 4. 全屏預覽camera2Basic示例項目
- 5. iphone項目中的ipad旋轉
- 6. DirectShow - 如何旋轉網絡攝像頭預覽視頻?
- 7. 從UISplitViewController的主面板顯示的視圖在從縱向到橫向(iPad)旋轉時不會旋轉
- 8. mp4parser不會旋轉視頻
- 9. 當iPad旋轉時旋轉視圖
- 10. Android:相機預覽的屏幕方向/旋轉
- 11. 面向方面的示例項目
- 12. QVideoWidget視頻預覽
- 13. Android:保留相機預覽方向更改,而其他視圖可以旋轉
- 14. iPad相機popover預覽錯誤的旋轉和縮放
- 15. iPhone旋轉視頻
- 16. PHP旋轉視頻
- 17. 旋轉avplayer視頻?
- 18. Vlcj視頻旋轉
- 19. PHP旋轉視頻
- 20. AVMutableComposition旋轉視頻
- 21. Android:如何在不同的進程中顯示相同的視頻預覽
- 22. 指定j2me上的視頻旋轉方向
- 23. 如何確定PHP/FFMPEG/PhoneGap中的視頻旋轉/方向?
- 24. 檢測方向的視頻和自動旋轉,如果需要
- 25. 轉換iphone到iPad,但屏幕不會自動旋轉,同時旋轉ipad
- 26. Android音頻示例項目
- 27. 更改iPad的方向,旋轉狀態欄,工具欄,但不是主視圖
- 28. 當它旋轉時,ipad設備的屏幕方向不正確
- 29. Android:相機預覽旋轉
- 30. 無法預覽的ipad中的mp4視頻
如何申請一個旋轉視圖層? – MikeN 2011-04-16 22:49:46
使用圖層的[affineTransform](http://developer.apple.com/library/ios/documentation/GraphicsImaging/Reference/CALayer_class/Introduction/Introduction.html#//apple_ref/occ/instm/CALayer/setAffineTransform :)或[transform](http://developer.apple.com/library/ios/documentation/GraphicsImaging/Reference/CALayer_class/Introduction/Introduction.html#//apple_ref/occ/instp/CALayer/transform)屬性。或者把它放在視圖中並使用視圖的[transform](http://developer.apple.com/library/ios/documentation/uikit/reference/UIView_Class/UIView/UIView.html#//apple_ref/occ/instp/ UIView /變形)道具。 – Anomie 2011-04-16 22:52:56