IOS图片展现的两种方法对比

作者: shaneZhang 分类: ios技术 发布时间: 2015-04-24 13:38

UIImageJPEGRepresentation

Returns the data for the specified image in JPEG format.

Parameters

image
The original image data.
compressionQuality
The quality of the resulting JPEG image, expressed as a value from 0.0 to 1.0. The value 0.0 represents the maximum compression (or lowest quality) while the value 1.0 represents the least compression (or best quality).

Return Value

A data object containing the JPEG data, or nil if there was a problem generating the data. This function may return nil if the image has no data or if the underlying CGImageRef contains data in an unsupported bitmap format.

Discussion

If the image object’s underlying image data has been purged, calling this function forces that data to be reloaded into memory.

UIImagePNGRepresentation

Returns the data for the specified image in PNG format

Declaration

NSData * UIImagePNGRepresentation ( UIImage *image );

Parameters

image
The original image data.

Return Value

A data object containing the PNG data, or nil if there was a problem generating the data. This function may return nil if the image has no data or if the underlying CGImageRef contains data in an unsupported bitmap format.

Discussion

if the image object’s underlying image data has been purged, calling this function forces that data to be reloaded into memory.

本页面支持AMP友好显示:IOS图片展现的两种方法对比

如果觉得我的文章对您有用,请随意打赏。如果有其他问题请联系博主QQ(909491009)或者下方留言!

发表评论

电子邮件地址不会被公开。 必填项已用*标注

20 ÷ = 2

This site uses Akismet to reduce spam. Learn how your comment data is processed.