編集:私の答えを修正していただきありがとうございます、ベライゾンネットワーク最適化による画像圧縮のいくつかのメカニズムがあります。
バイトストリームの観点から見た画像の品質は、圧縮の有無をサーバーが提供するかどうかに依存すると思います。
しかし、いくつかの解決策があります。NSURLConnectionDataDelegate
スレッドプログラミングを使用して、URLリクエストからのデータを処理するように実装することもできます。面白い方法があります:
/** connection:didReceiveResponse: is called when
* enough data has been read to construct an
* NSURLResponse object. In the event of a protocol
* which may return multiple responses (such as HTTP
* multipart/x-mixed-replace) the delegate should be
* prepared to inspect the new response and make
* itself ready for data callbacks as appropriate.
**/
- (void)connection:(NSURLConnection *)connection didReceiveResponse:(NSURLResponse *)response;
/** connection:didReceiveData: is called with a single
* immutable NSData object to the delegate,
* representing the next portion of the data loaded
* from the connection. This is the only guaranteed
* for the delegate to receive the data from the
* resource load
**/
- (void)connection:(NSURLConnection *)connection didReceiveData:(NSData *)data;
/** connection:willCacheResponse: gives the delegate
* an opportunity to inspect and modify the
* NSCachedURLResponse which will be cached by the
* loader if caching is enabled for the original
* NSURLRequest. Returning nil from this delegate
* will prevent the resource from being cached. Note
* that the -data method of the cached response may
* return an autoreleased in-memory copy of the true
* data, and should not be used as an alternative to
* receiving and accumulating the data through
* connection:didReceiveData
**/
- (NSCachedURLResponse *)connection:(NSURLConnection *)connection willCacheResponse:(NSCachedURLResponse *)cachedResponse;
/** connectionDidFinishLoading: is called when all
* connection processing has completed successfully,
* before the delegate is released by the
* connection
**/
- (void)connectionDidFinishLoading:(NSURLConnection *)connection;
didReceiveData
また、各受信データを蓄積してデータを管理することもできます。ダウンロードが完了connectionDidFinishLoading
すると、NSData
で、すべてを受信した画像を処理できます。
お役に立てば幸いです。