From 6729aab108f274331060bd93d3ecca5758777873 Mon Sep 17 00:00:00 2001 From: jverkoey Date: Sun, 3 Jul 2011 06:01:48 -0400 Subject: [PATCH] [networkimage] Flesh out the sample project even further. Add a total pixel count label and make things look sexier. --- .../project.pbxproj | 148 +++++++++--------- .../src/BasicNetworkImage_Prefix.pch | 1 + .../src/RootViewController.h | 8 +- .../src/RootViewController.m | 75 ++++++++- 4 files changed, 154 insertions(+), 78 deletions(-) diff --git a/examples/networkimage/BasicNetworkImage/BasicNetworkImage.xcodeproj/project.pbxproj b/examples/networkimage/BasicNetworkImage/BasicNetworkImage.xcodeproj/project.pbxproj index 494f33116..017d3e723 100755 --- a/examples/networkimage/BasicNetworkImage/BasicNetworkImage.xcodeproj/project.pbxproj +++ b/examples/networkimage/BasicNetworkImage/BasicNetworkImage.xcodeproj/project.pbxproj @@ -27,15 +27,6 @@ 66EA061513C01C66004FFE1A /* NIState.m in Sources */ = {isa = PBXBuildFile; fileRef = 66EA060713C01C66004FFE1A /* NIState.m */; }; 66EA061613C01C66004FFE1A /* NSData+NimbusCore.m in Sources */ = {isa = PBXBuildFile; fileRef = 66EA060813C01C66004FFE1A /* NSData+NimbusCore.m */; }; 66EA061713C01C66004FFE1A /* NSString+NimbusCore.m in Sources */ = {isa = PBXBuildFile; fileRef = 66EA060913C01C66004FFE1A /* NSString+NimbusCore.m */; }; - 66EA066F13C01C76004FFE1A /* ASIAuthenticationDialog.m in Sources */ = {isa = PBXBuildFile; fileRef = 66EA061B13C01C76004FFE1A /* ASIAuthenticationDialog.m */; }; - 66EA067013C01C76004FFE1A /* ASIDataCompressor.m in Sources */ = {isa = PBXBuildFile; fileRef = 66EA061E13C01C76004FFE1A /* ASIDataCompressor.m */; }; - 66EA067113C01C76004FFE1A /* ASIDataDecompressor.m in Sources */ = {isa = PBXBuildFile; fileRef = 66EA062013C01C76004FFE1A /* ASIDataDecompressor.m */; }; - 66EA067213C01C76004FFE1A /* ASIDownloadCache.m in Sources */ = {isa = PBXBuildFile; fileRef = 66EA062213C01C76004FFE1A /* ASIDownloadCache.m */; }; - 66EA067313C01C76004FFE1A /* ASIFormDataRequest.m in Sources */ = {isa = PBXBuildFile; fileRef = 66EA062413C01C76004FFE1A /* ASIFormDataRequest.m */; }; - 66EA067413C01C76004FFE1A /* ASIHTTPRequest.m in Sources */ = {isa = PBXBuildFile; fileRef = 66EA062613C01C76004FFE1A /* ASIHTTPRequest.m */; }; - 66EA067513C01C76004FFE1A /* ASIInputStream.m in Sources */ = {isa = PBXBuildFile; fileRef = 66EA062A13C01C76004FFE1A /* ASIInputStream.m */; }; - 66EA067613C01C76004FFE1A /* ASINetworkQueue.m in Sources */ = {isa = PBXBuildFile; fileRef = 66EA062C13C01C76004FFE1A /* ASINetworkQueue.m */; }; - 66EA067F13C01C76004FFE1A /* Reachability.m in Sources */ = {isa = PBXBuildFile; fileRef = 66EA064213C01C76004FFE1A /* Reachability.m */; }; 66EA06A713C01D10004FFE1A /* NIHTTPImageRequest.m in Sources */ = {isa = PBXBuildFile; fileRef = 66EA06A313C01D10004FFE1A /* NIHTTPImageRequest.m */; }; 66EA06A813C01D10004FFE1A /* NINetworkImageView.m in Sources */ = {isa = PBXBuildFile; fileRef = 66EA06A613C01D10004FFE1A /* NINetworkImageView.m */; }; 66EA06B313C01D4F004FFE1A /* libz.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = 66EA06B213C01D4F004FFE1A /* libz.dylib */; }; @@ -43,6 +34,16 @@ 66EA06C613C01D9D004FFE1A /* SystemConfiguration.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 66EA06BE13C01D7B004FFE1A /* SystemConfiguration.framework */; }; 66EA06C913C01DA8004FFE1A /* MobileCoreServices.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 66EA06B613C01D6E004FFE1A /* MobileCoreServices.framework */; }; 66EA070C13C01F2F004FFE1A /* nimbus64x64.png in Resources */ = {isa = PBXBuildFile; fileRef = 66EA070B13C01F2F004FFE1A /* nimbus64x64.png */; }; + 66EA0C8713C05DCF004FFE1A /* ASIAuthenticationDialog.m in Sources */ = {isa = PBXBuildFile; fileRef = 66EA0C6F13C05DCE004FFE1A /* ASIAuthenticationDialog.m */; }; + 66EA0C8813C05DCF004FFE1A /* ASIDataCompressor.m in Sources */ = {isa = PBXBuildFile; fileRef = 66EA0C7213C05DCE004FFE1A /* ASIDataCompressor.m */; }; + 66EA0C8913C05DCF004FFE1A /* ASIDataDecompressor.m in Sources */ = {isa = PBXBuildFile; fileRef = 66EA0C7413C05DCE004FFE1A /* ASIDataDecompressor.m */; }; + 66EA0C8A13C05DCF004FFE1A /* ASIDownloadCache.m in Sources */ = {isa = PBXBuildFile; fileRef = 66EA0C7613C05DCE004FFE1A /* ASIDownloadCache.m */; }; + 66EA0C8B13C05DCF004FFE1A /* ASIFormDataRequest.m in Sources */ = {isa = PBXBuildFile; fileRef = 66EA0C7813C05DCF004FFE1A /* ASIFormDataRequest.m */; }; + 66EA0C8C13C05DCF004FFE1A /* ASIHTTPRequest.m in Sources */ = {isa = PBXBuildFile; fileRef = 66EA0C7A13C05DCF004FFE1A /* ASIHTTPRequest.m */; }; + 66EA0C8D13C05DCF004FFE1A /* ASIInputStream.m in Sources */ = {isa = PBXBuildFile; fileRef = 66EA0C7E13C05DCF004FFE1A /* ASIInputStream.m */; }; + 66EA0C8E13C05DCF004FFE1A /* ASINetworkQueue.m in Sources */ = {isa = PBXBuildFile; fileRef = 66EA0C8013C05DCF004FFE1A /* ASINetworkQueue.m */; }; + 66EA0C8F13C05DCF004FFE1A /* NIHTTPRequest.m in Sources */ = {isa = PBXBuildFile; fileRef = 66EA0C8313C05DCF004FFE1A /* NIHTTPRequest.m */; }; + 66EA0C9013C05DCF004FFE1A /* Reachability.m in Sources */ = {isa = PBXBuildFile; fileRef = 66EA0C8613C05DCF004FFE1A /* Reachability.m */; }; /* End PBXBuildFile section */ /* Begin PBXFileReference section */ @@ -86,28 +87,6 @@ 66EA060713C01C66004FFE1A /* NIState.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = NIState.m; path = ../../../src/core/src/NIState.m; sourceTree = SOURCE_ROOT; }; 66EA060813C01C66004FFE1A /* NSData+NimbusCore.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = "NSData+NimbusCore.m"; path = "../../../src/core/src/NSData+NimbusCore.m"; sourceTree = SOURCE_ROOT; }; 66EA060913C01C66004FFE1A /* NSString+NimbusCore.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = "NSString+NimbusCore.m"; path = "../../../src/core/src/NSString+NimbusCore.m"; sourceTree = SOURCE_ROOT; }; - 66EA061A13C01C76004FFE1A /* ASIAuthenticationDialog.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = ASIAuthenticationDialog.h; path = ../../../src/ASIHTTPRequest/src/ASIAuthenticationDialog.h; sourceTree = SOURCE_ROOT; }; - 66EA061B13C01C76004FFE1A /* ASIAuthenticationDialog.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = ASIAuthenticationDialog.m; path = ../../../src/ASIHTTPRequest/src/ASIAuthenticationDialog.m; sourceTree = SOURCE_ROOT; }; - 66EA061C13C01C76004FFE1A /* ASICacheDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = ASICacheDelegate.h; path = ../../../src/ASIHTTPRequest/src/ASICacheDelegate.h; sourceTree = SOURCE_ROOT; }; - 66EA061D13C01C76004FFE1A /* ASIDataCompressor.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = ASIDataCompressor.h; path = ../../../src/ASIHTTPRequest/src/ASIDataCompressor.h; sourceTree = SOURCE_ROOT; }; - 66EA061E13C01C76004FFE1A /* ASIDataCompressor.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = ASIDataCompressor.m; path = ../../../src/ASIHTTPRequest/src/ASIDataCompressor.m; sourceTree = SOURCE_ROOT; }; - 66EA061F13C01C76004FFE1A /* ASIDataDecompressor.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = ASIDataDecompressor.h; path = ../../../src/ASIHTTPRequest/src/ASIDataDecompressor.h; sourceTree = SOURCE_ROOT; }; - 66EA062013C01C76004FFE1A /* ASIDataDecompressor.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = ASIDataDecompressor.m; path = ../../../src/ASIHTTPRequest/src/ASIDataDecompressor.m; sourceTree = SOURCE_ROOT; }; - 66EA062113C01C76004FFE1A /* ASIDownloadCache.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = ASIDownloadCache.h; path = ../../../src/ASIHTTPRequest/src/ASIDownloadCache.h; sourceTree = SOURCE_ROOT; }; - 66EA062213C01C76004FFE1A /* ASIDownloadCache.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = ASIDownloadCache.m; path = ../../../src/ASIHTTPRequest/src/ASIDownloadCache.m; sourceTree = SOURCE_ROOT; }; - 66EA062313C01C76004FFE1A /* ASIFormDataRequest.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = ASIFormDataRequest.h; path = ../../../src/ASIHTTPRequest/src/ASIFormDataRequest.h; sourceTree = SOURCE_ROOT; }; - 66EA062413C01C76004FFE1A /* ASIFormDataRequest.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = ASIFormDataRequest.m; path = ../../../src/ASIHTTPRequest/src/ASIFormDataRequest.m; sourceTree = SOURCE_ROOT; }; - 66EA062513C01C76004FFE1A /* ASIHTTPRequest.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = ASIHTTPRequest.h; path = ../../../src/ASIHTTPRequest/src/ASIHTTPRequest.h; sourceTree = SOURCE_ROOT; }; - 66EA062613C01C76004FFE1A /* ASIHTTPRequest.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = ASIHTTPRequest.m; path = ../../../src/ASIHTTPRequest/src/ASIHTTPRequest.m; sourceTree = SOURCE_ROOT; }; - 66EA062713C01C76004FFE1A /* ASIHTTPRequestConfig.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = ASIHTTPRequestConfig.h; path = ../../../src/ASIHTTPRequest/src/ASIHTTPRequestConfig.h; sourceTree = SOURCE_ROOT; }; - 66EA062813C01C76004FFE1A /* ASIHTTPRequestDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = ASIHTTPRequestDelegate.h; path = ../../../src/ASIHTTPRequest/src/ASIHTTPRequestDelegate.h; sourceTree = SOURCE_ROOT; }; - 66EA062913C01C76004FFE1A /* ASIInputStream.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = ASIInputStream.h; path = ../../../src/ASIHTTPRequest/src/ASIInputStream.h; sourceTree = SOURCE_ROOT; }; - 66EA062A13C01C76004FFE1A /* ASIInputStream.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = ASIInputStream.m; path = ../../../src/ASIHTTPRequest/src/ASIInputStream.m; sourceTree = SOURCE_ROOT; }; - 66EA062B13C01C76004FFE1A /* ASINetworkQueue.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = ASINetworkQueue.h; path = ../../../src/ASIHTTPRequest/src/ASINetworkQueue.h; sourceTree = SOURCE_ROOT; }; - 66EA062C13C01C76004FFE1A /* ASINetworkQueue.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = ASINetworkQueue.m; path = ../../../src/ASIHTTPRequest/src/ASINetworkQueue.m; sourceTree = SOURCE_ROOT; }; - 66EA062D13C01C76004FFE1A /* ASIProgressDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = ASIProgressDelegate.h; path = ../../../src/ASIHTTPRequest/src/ASIProgressDelegate.h; sourceTree = SOURCE_ROOT; }; - 66EA064113C01C76004FFE1A /* Reachability.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Reachability.h; sourceTree = ""; }; - 66EA064213C01C76004FFE1A /* Reachability.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = Reachability.m; sourceTree = ""; }; 66EA06A213C01D10004FFE1A /* NIHTTPImageRequest.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = NIHTTPImageRequest.h; path = ../../../src/networkimage/src/NIHTTPImageRequest.h; sourceTree = SOURCE_ROOT; }; 66EA06A313C01D10004FFE1A /* NIHTTPImageRequest.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = NIHTTPImageRequest.m; path = ../../../src/networkimage/src/NIHTTPImageRequest.m; sourceTree = SOURCE_ROOT; }; 66EA06A413C01D10004FFE1A /* NimbusNetworkImage.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = NimbusNetworkImage.h; path = ../../../src/networkimage/src/NimbusNetworkImage.h; sourceTree = SOURCE_ROOT; }; @@ -118,6 +97,30 @@ 66EA06BE13C01D7B004FFE1A /* SystemConfiguration.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = SystemConfiguration.framework; path = System/Library/Frameworks/SystemConfiguration.framework; sourceTree = SDKROOT; }; 66EA06C213C01D86004FFE1A /* CFNetwork.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CFNetwork.framework; path = System/Library/Frameworks/CFNetwork.framework; sourceTree = SDKROOT; }; 66EA070B13C01F2F004FFE1A /* nimbus64x64.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = nimbus64x64.png; path = ../../../src/resources/nimbus64x64.png; sourceTree = SOURCE_ROOT; }; + 66EA0C6E13C05DCE004FFE1A /* ASIAuthenticationDialog.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = ASIAuthenticationDialog.h; path = ../../../src/ASIHTTPRequest/src/ASIAuthenticationDialog.h; sourceTree = SOURCE_ROOT; }; + 66EA0C6F13C05DCE004FFE1A /* ASIAuthenticationDialog.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = ASIAuthenticationDialog.m; path = ../../../src/ASIHTTPRequest/src/ASIAuthenticationDialog.m; sourceTree = SOURCE_ROOT; }; + 66EA0C7013C05DCE004FFE1A /* ASICacheDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = ASICacheDelegate.h; path = ../../../src/ASIHTTPRequest/src/ASICacheDelegate.h; sourceTree = SOURCE_ROOT; }; + 66EA0C7113C05DCE004FFE1A /* ASIDataCompressor.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = ASIDataCompressor.h; path = ../../../src/ASIHTTPRequest/src/ASIDataCompressor.h; sourceTree = SOURCE_ROOT; }; + 66EA0C7213C05DCE004FFE1A /* ASIDataCompressor.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = ASIDataCompressor.m; path = ../../../src/ASIHTTPRequest/src/ASIDataCompressor.m; sourceTree = SOURCE_ROOT; }; + 66EA0C7313C05DCE004FFE1A /* ASIDataDecompressor.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = ASIDataDecompressor.h; path = ../../../src/ASIHTTPRequest/src/ASIDataDecompressor.h; sourceTree = SOURCE_ROOT; }; + 66EA0C7413C05DCE004FFE1A /* ASIDataDecompressor.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = ASIDataDecompressor.m; path = ../../../src/ASIHTTPRequest/src/ASIDataDecompressor.m; sourceTree = SOURCE_ROOT; }; + 66EA0C7513C05DCE004FFE1A /* ASIDownloadCache.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = ASIDownloadCache.h; path = ../../../src/ASIHTTPRequest/src/ASIDownloadCache.h; sourceTree = SOURCE_ROOT; }; + 66EA0C7613C05DCE004FFE1A /* ASIDownloadCache.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = ASIDownloadCache.m; path = ../../../src/ASIHTTPRequest/src/ASIDownloadCache.m; sourceTree = SOURCE_ROOT; }; + 66EA0C7713C05DCF004FFE1A /* ASIFormDataRequest.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = ASIFormDataRequest.h; path = ../../../src/ASIHTTPRequest/src/ASIFormDataRequest.h; sourceTree = SOURCE_ROOT; }; + 66EA0C7813C05DCF004FFE1A /* ASIFormDataRequest.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = ASIFormDataRequest.m; path = ../../../src/ASIHTTPRequest/src/ASIFormDataRequest.m; sourceTree = SOURCE_ROOT; }; + 66EA0C7913C05DCF004FFE1A /* ASIHTTPRequest.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = ASIHTTPRequest.h; path = ../../../src/ASIHTTPRequest/src/ASIHTTPRequest.h; sourceTree = SOURCE_ROOT; }; + 66EA0C7A13C05DCF004FFE1A /* ASIHTTPRequest.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = ASIHTTPRequest.m; path = ../../../src/ASIHTTPRequest/src/ASIHTTPRequest.m; sourceTree = SOURCE_ROOT; }; + 66EA0C7B13C05DCF004FFE1A /* ASIHTTPRequestConfig.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = ASIHTTPRequestConfig.h; path = ../../../src/ASIHTTPRequest/src/ASIHTTPRequestConfig.h; sourceTree = SOURCE_ROOT; }; + 66EA0C7C13C05DCF004FFE1A /* ASIHTTPRequestDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = ASIHTTPRequestDelegate.h; path = ../../../src/ASIHTTPRequest/src/ASIHTTPRequestDelegate.h; sourceTree = SOURCE_ROOT; }; + 66EA0C7D13C05DCF004FFE1A /* ASIInputStream.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = ASIInputStream.h; path = ../../../src/ASIHTTPRequest/src/ASIInputStream.h; sourceTree = SOURCE_ROOT; }; + 66EA0C7E13C05DCF004FFE1A /* ASIInputStream.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = ASIInputStream.m; path = ../../../src/ASIHTTPRequest/src/ASIInputStream.m; sourceTree = SOURCE_ROOT; }; + 66EA0C7F13C05DCF004FFE1A /* ASINetworkQueue.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = ASINetworkQueue.h; path = ../../../src/ASIHTTPRequest/src/ASINetworkQueue.h; sourceTree = SOURCE_ROOT; }; + 66EA0C8013C05DCF004FFE1A /* ASINetworkQueue.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = ASINetworkQueue.m; path = ../../../src/ASIHTTPRequest/src/ASINetworkQueue.m; sourceTree = SOURCE_ROOT; }; + 66EA0C8113C05DCF004FFE1A /* ASIProgressDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = ASIProgressDelegate.h; path = ../../../src/ASIHTTPRequest/src/ASIProgressDelegate.h; sourceTree = SOURCE_ROOT; }; + 66EA0C8213C05DCF004FFE1A /* NIHTTPRequest.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = NIHTTPRequest.h; path = ../../../src/ASIHTTPRequest/src/NIHTTPRequest.h; sourceTree = SOURCE_ROOT; }; + 66EA0C8313C05DCF004FFE1A /* NIHTTPRequest.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = NIHTTPRequest.m; path = ../../../src/ASIHTTPRequest/src/NIHTTPRequest.m; sourceTree = SOURCE_ROOT; }; + 66EA0C8513C05DCF004FFE1A /* Reachability.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Reachability.h; sourceTree = ""; }; + 66EA0C8613C05DCF004FFE1A /* Reachability.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = Reachability.m; sourceTree = ""; }; /* End PBXFileReference section */ /* Begin PBXFrameworksBuildPhase section */ @@ -251,41 +254,33 @@ 66EA061813C01C6D004FFE1A /* ASIHTTPRequest */ = { isa = PBXGroup; children = ( - 66EA061A13C01C76004FFE1A /* ASIAuthenticationDialog.h */, - 66EA061B13C01C76004FFE1A /* ASIAuthenticationDialog.m */, - 66EA061C13C01C76004FFE1A /* ASICacheDelegate.h */, - 66EA061D13C01C76004FFE1A /* ASIDataCompressor.h */, - 66EA061E13C01C76004FFE1A /* ASIDataCompressor.m */, - 66EA061F13C01C76004FFE1A /* ASIDataDecompressor.h */, - 66EA062013C01C76004FFE1A /* ASIDataDecompressor.m */, - 66EA062113C01C76004FFE1A /* ASIDownloadCache.h */, - 66EA062213C01C76004FFE1A /* ASIDownloadCache.m */, - 66EA062313C01C76004FFE1A /* ASIFormDataRequest.h */, - 66EA062413C01C76004FFE1A /* ASIFormDataRequest.m */, - 66EA062513C01C76004FFE1A /* ASIHTTPRequest.h */, - 66EA062613C01C76004FFE1A /* ASIHTTPRequest.m */, - 66EA062713C01C76004FFE1A /* ASIHTTPRequestConfig.h */, - 66EA062813C01C76004FFE1A /* ASIHTTPRequestDelegate.h */, - 66EA062913C01C76004FFE1A /* ASIInputStream.h */, - 66EA062A13C01C76004FFE1A /* ASIInputStream.m */, - 66EA062B13C01C76004FFE1A /* ASINetworkQueue.h */, - 66EA062C13C01C76004FFE1A /* ASINetworkQueue.m */, - 66EA062D13C01C76004FFE1A /* ASIProgressDelegate.h */, - 66EA064013C01C76004FFE1A /* Reachability */, + 66EA0C6E13C05DCE004FFE1A /* ASIAuthenticationDialog.h */, + 66EA0C6F13C05DCE004FFE1A /* ASIAuthenticationDialog.m */, + 66EA0C7013C05DCE004FFE1A /* ASICacheDelegate.h */, + 66EA0C7113C05DCE004FFE1A /* ASIDataCompressor.h */, + 66EA0C7213C05DCE004FFE1A /* ASIDataCompressor.m */, + 66EA0C7313C05DCE004FFE1A /* ASIDataDecompressor.h */, + 66EA0C7413C05DCE004FFE1A /* ASIDataDecompressor.m */, + 66EA0C7513C05DCE004FFE1A /* ASIDownloadCache.h */, + 66EA0C7613C05DCE004FFE1A /* ASIDownloadCache.m */, + 66EA0C7713C05DCF004FFE1A /* ASIFormDataRequest.h */, + 66EA0C7813C05DCF004FFE1A /* ASIFormDataRequest.m */, + 66EA0C7913C05DCF004FFE1A /* ASIHTTPRequest.h */, + 66EA0C7A13C05DCF004FFE1A /* ASIHTTPRequest.m */, + 66EA0C7B13C05DCF004FFE1A /* ASIHTTPRequestConfig.h */, + 66EA0C7C13C05DCF004FFE1A /* ASIHTTPRequestDelegate.h */, + 66EA0C7D13C05DCF004FFE1A /* ASIInputStream.h */, + 66EA0C7E13C05DCF004FFE1A /* ASIInputStream.m */, + 66EA0C7F13C05DCF004FFE1A /* ASINetworkQueue.h */, + 66EA0C8013C05DCF004FFE1A /* ASINetworkQueue.m */, + 66EA0C8113C05DCF004FFE1A /* ASIProgressDelegate.h */, + 66EA0C8213C05DCF004FFE1A /* NIHTTPRequest.h */, + 66EA0C8313C05DCF004FFE1A /* NIHTTPRequest.m */, + 66EA0C8413C05DCF004FFE1A /* Reachability */, ); name = ASIHTTPRequest; sourceTree = ""; }; - 66EA064013C01C76004FFE1A /* Reachability */ = { - isa = PBXGroup; - children = ( - 66EA064113C01C76004FFE1A /* Reachability.h */, - 66EA064213C01C76004FFE1A /* Reachability.m */, - ); - name = Reachability; - path = ../../../src/ASIHTTPRequest/src/Reachability; - sourceTree = SOURCE_ROOT; - }; 66EA06A013C01CFD004FFE1A /* Network Image */ = { isa = PBXGroup; children = ( @@ -298,6 +293,16 @@ name = "Network Image"; sourceTree = ""; }; + 66EA0C8413C05DCF004FFE1A /* Reachability */ = { + isa = PBXGroup; + children = ( + 66EA0C8513C05DCF004FFE1A /* Reachability.h */, + 66EA0C8613C05DCF004FFE1A /* Reachability.m */, + ); + name = Reachability; + path = ../../../src/ASIHTTPRequest/src/Reachability; + sourceTree = SOURCE_ROOT; + }; /* End PBXGroup section */ /* Begin PBXNativeTarget section */ @@ -375,17 +380,18 @@ 66EA061513C01C66004FFE1A /* NIState.m in Sources */, 66EA061613C01C66004FFE1A /* NSData+NimbusCore.m in Sources */, 66EA061713C01C66004FFE1A /* NSString+NimbusCore.m in Sources */, - 66EA066F13C01C76004FFE1A /* ASIAuthenticationDialog.m in Sources */, - 66EA067013C01C76004FFE1A /* ASIDataCompressor.m in Sources */, - 66EA067113C01C76004FFE1A /* ASIDataDecompressor.m in Sources */, - 66EA067213C01C76004FFE1A /* ASIDownloadCache.m in Sources */, - 66EA067313C01C76004FFE1A /* ASIFormDataRequest.m in Sources */, - 66EA067413C01C76004FFE1A /* ASIHTTPRequest.m in Sources */, - 66EA067513C01C76004FFE1A /* ASIInputStream.m in Sources */, - 66EA067613C01C76004FFE1A /* ASINetworkQueue.m in Sources */, - 66EA067F13C01C76004FFE1A /* Reachability.m in Sources */, 66EA06A713C01D10004FFE1A /* NIHTTPImageRequest.m in Sources */, 66EA06A813C01D10004FFE1A /* NINetworkImageView.m in Sources */, + 66EA0C8713C05DCF004FFE1A /* ASIAuthenticationDialog.m in Sources */, + 66EA0C8813C05DCF004FFE1A /* ASIDataCompressor.m in Sources */, + 66EA0C8913C05DCF004FFE1A /* ASIDataDecompressor.m in Sources */, + 66EA0C8A13C05DCF004FFE1A /* ASIDownloadCache.m in Sources */, + 66EA0C8B13C05DCF004FFE1A /* ASIFormDataRequest.m in Sources */, + 66EA0C8C13C05DCF004FFE1A /* ASIHTTPRequest.m in Sources */, + 66EA0C8D13C05DCF004FFE1A /* ASIInputStream.m in Sources */, + 66EA0C8E13C05DCF004FFE1A /* ASINetworkQueue.m in Sources */, + 66EA0C8F13C05DCF004FFE1A /* NIHTTPRequest.m in Sources */, + 66EA0C9013C05DCF004FFE1A /* Reachability.m in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; diff --git a/examples/networkimage/BasicNetworkImage/src/BasicNetworkImage_Prefix.pch b/examples/networkimage/BasicNetworkImage/src/BasicNetworkImage_Prefix.pch index 9fcad8b35..5ceda171e 100644 --- a/examples/networkimage/BasicNetworkImage/src/BasicNetworkImage_Prefix.pch +++ b/examples/networkimage/BasicNetworkImage/src/BasicNetworkImage_Prefix.pch @@ -5,6 +5,7 @@ #ifdef __OBJC__ #import #import + #import #import "NimbusCore.h" #import "NimbusNetworkImage.h" #endif diff --git a/examples/networkimage/BasicNetworkImage/src/RootViewController.h b/examples/networkimage/BasicNetworkImage/src/RootViewController.h index 402ee566f..dc45b34c3 100644 --- a/examples/networkimage/BasicNetworkImage/src/RootViewController.h +++ b/examples/networkimage/BasicNetworkImage/src/RootViewController.h @@ -17,10 +17,14 @@ #import #import -@interface RootViewController : UIViewController { +@interface RootViewController : UIViewController < + NINetworkImageViewDelegate +> { @private - UIScrollView* _scrollView; + UIScrollView* _scrollView; NSMutableArray* _networkImageViews; + + UILabel* _memoryUsageLabel; } @end diff --git a/examples/networkimage/BasicNetworkImage/src/RootViewController.m b/examples/networkimage/BasicNetworkImage/src/RootViewController.m index 27997aa9e..657dc84d0 100644 --- a/examples/networkimage/BasicNetworkImage/src/RootViewController.m +++ b/examples/networkimage/BasicNetworkImage/src/RootViewController.m @@ -17,6 +17,7 @@ #import "RootViewController.h" static const CGFloat kFramePadding = 10; +static const CGFloat kTextBottomMargin = 10; static const CGFloat kImageDimensions = 93; static const CGFloat kImageSpacing = 10; @@ -34,7 +35,10 @@ - (NINetworkImageView *)networkImageView { NINetworkImageView* networkImageView = [[[NINetworkImageView alloc] initWithImage:initialImage] autorelease]; - networkImageView.backgroundColor = [UIColor colorWithRed:0 green:0 blue:0.3 alpha:1]; + networkImageView.backgroundColor = [UIColor colorWithWhite:0 alpha:1]; + networkImageView.layer.borderColor = [[UIColor colorWithWhite:1 alpha:0.3] CGColor]; + networkImageView.layer.borderWidth = 1; + networkImageView.delegate = self; return networkImageView; } @@ -42,11 +46,11 @@ - (NINetworkImageView *)networkImageView { /////////////////////////////////////////////////////////////////////////////////////////////////// - (void)layoutImageViewsForOrientation:(UIInterfaceOrientation)orientation { - CGRect frame = self.view.bounds; + CGRect frame = _scrollView.bounds; CGFloat maxRightEdge = 0; CGFloat currentX = kFramePadding; - CGFloat currentY = kFramePadding; + CGFloat currentY = 0; for (NINetworkImageView* imageView in _networkImageViews) { imageView.frame = CGRectMake(currentX, currentY, kImageDimensions, kImageDimensions); @@ -60,6 +64,10 @@ - (void)layoutImageViewsForOrientation:(UIInterfaceOrientation)orientation { } } + if (currentX == kFramePadding) { + currentY -= kImageDimensions + kImageSpacing; + } + CGFloat contentWidth = (maxRightEdge + kFramePadding); CGFloat contentPadding = floorf((frame.size.width - contentWidth) / 2); @@ -78,16 +86,56 @@ - (void)layoutImageViewsForOrientation:(UIInterfaceOrientation)orientation { - (void)loadView { [super loadView]; + self.view.backgroundColor = [UIColor colorWithWhite:0.8 alpha:1]; + + // Try experimenting with the maximum number of concurrent operations. By making it one, + // we force the network operations to happen serially. This can be useful for avoiding + // thrashing of the disk and network. + // Watch how the app works with a max of 1 versus not defining a max at all and allowing the + // device to spin off as many threads as it wants to. + // + // Spoiler alert! When the max is 1, the first image loads and then all of the others load + // instantly. + // When the max is unset, all of the images take a bit longer to load. + + [[Nimbus globalNetworkOperationQueue] setMaxConcurrentOperationCount:1]; + + + // Try experimenting with this value to see how the total number of pixels is affected. + + //[[Nimbus globalImageMemoryCache] setMaxNumberOfPixels:94*94]; + + + _memoryUsageLabel = [[UILabel alloc] init]; + _memoryUsageLabel.backgroundColor = self.view.backgroundColor; + _memoryUsageLabel.textColor = [UIColor colorWithWhite:0.1 alpha:1]; + _memoryUsageLabel.shadowColor = [UIColor colorWithWhite:1 alpha:1]; + _memoryUsageLabel.shadowOffset = CGSizeMake(0, 1); + _memoryUsageLabel.font = [UIFont boldSystemFontOfSize:14]; + _memoryUsageLabel.text = @"Fetching the images..."; + [_memoryUsageLabel sizeToFit]; + _memoryUsageLabel.frame = CGRectMake(kFramePadding, kFramePadding, + _memoryUsageLabel.frame.size.width, + _memoryUsageLabel.frame.size.height); + + [self.view addSubview:_memoryUsageLabel]; + _networkImageViews = [[NSMutableArray alloc] init]; - _scrollView = [[[UIScrollView alloc] initWithFrame:self.view.bounds] autorelease]; + _scrollView = [[[UIScrollView alloc] initWithFrame: + NIRectShift(self.view.bounds, + 0, CGRectGetMaxY(_memoryUsageLabel.frame) + kTextBottomMargin)] + autorelease]; _scrollView.indicatorStyle = UIScrollViewIndicatorStyleWhite; _scrollView.autoresizingMask = (UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight); for (NSInteger ix = UIViewContentModeScaleToFill; ix <= UIViewContentModeBottomRight; ++ix) { + if (UIViewContentModeRedraw == ix) { + // Unsupported mode. + continue; + } NINetworkImageView* networkImageView = [self networkImageView]; - networkImageView.backgroundColor = [UIColor colorWithWhite:0.3 alpha:1]; networkImageView.contentMode = ix; @@ -130,4 +178,21 @@ - (void)willAnimateRotationToInterfaceOrientation: (UIInterfaceOrientation)toInt } +/////////////////////////////////////////////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////////////////////////////////////////////// +#pragma mark - +#pragma mark NINetworkImageViewDelegate + + +/////////////////////////////////////////////////////////////////////////////////////////////////// +- (void)networkImageView:(NINetworkImageView *)imageView didLoadImage:(UIImage *)image { + _memoryUsageLabel.text = [NSString stringWithFormat:@"In-memory cache size: %d pixels", + [[Nimbus globalImageMemoryCache] numberOfPixels]]; + [_memoryUsageLabel sizeToFit]; + _memoryUsageLabel.frame = CGRectMake(kFramePadding, kFramePadding, + _memoryUsageLabel.frame.size.width, + _memoryUsageLabel.frame.size.height); +} + + @end