如何在iPhone編程中旋轉圖像?如何旋轉iPhone上的圖像?
1
A
回答
0
您可以使用CCGAffineTransform旋轉視圖。您可以通過指定要旋轉的弧度度數來創建旋轉矩陣,然後將旋轉矩陣設置爲視圖的.transform屬性。
2
一個偉大的旋轉和圖像的UIImage類艾倫布倫森可以在這裏找到: http://www.platinumball.net/blog/2010/01/31/iphone-uiimage-rotation-and-scaling/
+0
感謝您的偉大鏈接:)。 – 2013-03-12 08:33:13
1
image.transform = CGAffineTransformMakeRotation(3.142);
旋轉180度。
0
//If someone needs in swift 3
func rotateImageClockWise(theImage: UIImage,imageView:UIImageView) -> UIImage {
var orient: UIImageOrientation!
let imgOrientation = theImage.imageOrientation
UIView.transition(with: imageView, duration: 0.2, options: .transitionCrossDissolve, animations: {() -> Void in
switch imgOrientation {
case .left:
orient = .up
case .right:
orient = .down
case .up:
orient = .right
case .down:
orient = .left
case .upMirrored:
orient = .rightMirrored
case .downMirrored:
orient = .leftMirrored
case .leftMirrored:
orient = .upMirrored
case .rightMirrored:
orient = .downMirrored
}
}, completion: { _ in })
let rotatedImage = UIImage(cgImage: theImage.cgImage!, scale: 1.0, orientation: orient)
return rotatedImage
}
//Just call the method like this :
rotateImageClockWise(theImage: UIImage,imageView:UIImageView)
相關問題
- 1. 如何在iPhone中旋轉圖像?
- 2. 旋轉圖像也拉伸或iPhone上
- 3. 旋轉BackgroundWorker.DoWork上的圖像
- 4. 圖像上的3D旋轉
- 5. 如何在圓周上旋轉圖像?
- 6. iPhone上的圖像轉換,如何?
- 7. Iphone imagecopy旋轉我的圖像
- 8. jquery在iPhone中的圖像旋轉
- 9. 如何在iPhone中旋轉我的屏幕截圖圖像?
- 10. PHP iphone/iOS6的上傳旋轉的問題:什麼是保存旋轉圖像
- 11. 如何旋轉圖像?
- 12. 如何旋轉圖像幀?
- 13. 如何旋轉圖像wpf
- 14. 上傳到網絡時,iPhone攝像頭圖像會旋轉
- 15. 在背景圖像上旋轉圖像
- 16. 旋轉並調整圖像大小+ iPhone
- 17. iphone image只旋轉部分圖像
- 18. iphone:如何旋轉帶觸摸事件的矩形圖像?
- 19. 如何保存iphone相冊中的旋轉圖像?
- 20. 如何在iPhone中旋轉iOS中的圖像?
- 21. 如何旋轉使用iPhone的電暈sdk圖像
- 22. ACTION_MOVE上的圖像視圖旋轉
- 23. Android - 如何在圖像上旋轉圖像查看
- 24. iPhone上的動畫 - 使用圖像序列或旋轉?
- 25. iphone桌面上的某些圖像會自動旋轉
- 26. 旋轉iPhone/iPad上的圖像適合屏幕?
- 27. 縮放圖像以適應iPhone上的屏幕旋轉
- 28. 旋轉圖像
- 29. - 旋轉圖像
- 30. 旋轉圖像
Dupe? http://stackoverflow.com/questions/917713/uiimage-rotation-custom-degrees – crashmstr 2009-06-05 12:53:16
可能是一個騙局,但取決於OP實際上想做什麼。 Raju,目標是什麼?你的意思是「獲取旋轉的UIImage的副本嗎?」或者也許「顯示旋轉的圖像?」或者,也許「使圖像旋轉動畫?」這是一個非常含糊的問題。 – 2009-06-05 14:17:29
這也可能類似於他所問:http://stackoverflow.com/questions/839296/how-can-i-rotate-a-uiimageview-with-respect-to-any-point-other-than-its - 中心 – 2009-06-05 16:24:38