你好,我有一個視圖,我可以畫線。 現在我想將其轉換爲base64圖像,那麼如何做到這一點? 在此先感謝。如何在iPhone中的base64圖像轉換視圖?
2
A
回答
3
UIGraphicsBeginImageContext(view.bounds.size);
[view.layer renderInContext:UIGraphicsGetCurrentContext()];
UIImage *viewImage = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();
NSData *imagedata = UIImagePNGRepresentation(viewimage);
NSString *encodedString = [imageData base64Encoding];
其中視圖是繪製線條的視圖。
0
此外,爲了將NSData轉換爲Base64字符串,您需要使用第三方代碼。我建議你使用由Math Gallagher編寫的Base64類別,這與我成功地使用了。這是鏈接:http://cocoawithlove.com/2009/06/base64-encoding-options-on-mac-and.html
相關問題
- 1. 如何將base64 svg圖像轉換爲base64圖像png
- 2. 如何將圖像(BYTE *)轉換爲Base64
- 3. 如何將Uri圖像轉換爲Base64?
- 4. 轉換圖像到base64
- 5. 在Python中將base64轉換爲圖像
- 6. 在GDK中將圖像轉換爲base64
- 7. 如何將圖像URL轉換的base64圖像源usign的JavaScript
- 8. 轉換成圖像的base64在WP8
- 9. iPhone上的圖像轉換,如何?
- 10. 如何將圖像轉換爲base64而無需在swift 2.0中丟失圖像?
- 11. 如何在Android中將Base64 Blob字符串轉換爲圖像?
- 12. base64轉換的data:URL圖像斑點
- 13. 轉換投稿圖像的Base64
- 14. iPhone/iPad的Base64圖像編碼 - 轉換爲UIImage
- 15. 如何將圖像從Picturebox(VB6中的圖像)轉換爲字符串(Base64)?
- 16. 如何將base64字符串圖像轉換爲android中的blob?
- 17. 如何將圖像轉換爲android中的base64二進制值?
- 18. 如何將圖像轉換爲xamarin.android中的base64?
- 19. 如何將圖像轉換爲文件中的Base64字符串?
- 20. 如何將圖像轉換爲C中的base64?
- 21. 如何將BASE64轉換爲Codeigniter中的圖像?
- 22. 如何將圖像轉換爲iPhone上的視頻?
- 23. C#base64轉換爲JPG圖像
- 24. 圖像轉換爲base64而不上傳
- 25. 將圖像數組轉換爲Base64
- 26. 將本地圖像轉換爲base64 javascript
- 27. Java - 將圖像轉換爲Base64
- 28. 如何將大量的base64圖像數據轉換回帶有PHP的圖像?
- 29. 如何將iPhone攝像頭座標轉換爲視圖座標?
- 30. 如何將NSMutableData轉換爲視圖中的圖像?