Permalink
Browse files

Updated to version 1.5

  • Loading branch information...
1 parent 1323155 commit bf3124ff3872ff2a3a7da0edc41c369e3fdac9cf @nicklockwood committed Dec 18, 2012
@@ -7,6 +7,7 @@
objects = {
/* Begin PBXBuildFile section */
+ 01FDC29916811842001E49A6 /* Default-568h@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 01FDC29816811842001E49A6 /* Default-568h@2x.png */; };
B22B852E156528300001A7C2 /* UIKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = B22B852D156528300001A7C2 /* UIKit.framework */; };
B22B8530156528300001A7C2 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = B22B852F156528300001A7C2 /* Foundation.framework */; };
B22B8532156528300001A7C2 /* CoreGraphics.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = B22B8531156528300001A7C2 /* CoreGraphics.framework */; };
@@ -19,6 +20,7 @@
/* End PBXBuildFile section */
/* Begin PBXFileReference section */
+ 01FDC29816811842001E49A6 /* Default-568h@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "Default-568h@2x.png"; sourceTree = "<group>"; };
B22B8529156528300001A7C2 /* BasicAuth.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = BasicAuth.app; sourceTree = BUILT_PRODUCTS_DIR; };
B22B852D156528300001A7C2 /* UIKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = UIKit.framework; path = System/Library/Frameworks/UIKit.framework; sourceTree = SDKROOT; };
B22B852F156528300001A7C2 /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = System/Library/Frameworks/Foundation.framework; sourceTree = SDKROOT; };
@@ -94,6 +96,7 @@
B22B8534156528300001A7C2 /* Supporting Files */ = {
isa = PBXGroup;
children = (
+ 01FDC29816811842001E49A6 /* Default-568h@2x.png */,
B22B8535156528300001A7C2 /* BasicAuth-Info.plist */,
B22B8536156528300001A7C2 /* InfoPlist.strings */,
B22B8539156528300001A7C2 /* main.m */,
@@ -164,6 +167,7 @@
files = (
B22B8538156528300001A7C2 /* InfoPlist.strings in Resources */,
B22B8544156528300001A7C2 /* ViewController.xib in Resources */,
+ 01FDC29916811842001E49A6 /* Default-568h@2x.png in Resources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
@@ -209,6 +213,7 @@
ALWAYS_SEARCH_USER_PATHS = NO;
ARCHS = "$(ARCHS_STANDARD_32_BIT)";
CLANG_ENABLE_OBJC_ARC = YES;
+ CLANG_WARN_OBJCPP_ARC_ABI = YES;
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
COPY_PHASE_STRIP = NO;
GCC_C_LANGUAGE_STANDARD = gnu99;
@@ -219,11 +224,13 @@
"$(inherited)",
);
GCC_SYMBOLS_PRIVATE_EXTERN = NO;
+ GCC_TREAT_WARNINGS_AS_ERRORS = YES;
GCC_VERSION = com.apple.compilers.llvm.clang.1_0;
GCC_WARN_ABOUT_RETURN_TYPE = YES;
GCC_WARN_UNINITIALIZED_AUTOS = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 5.1;
+ RUN_CLANG_STATIC_ANALYZER = YES;
SDKROOT = iphoneos;
};
name = Debug;
@@ -234,15 +241,18 @@
ALWAYS_SEARCH_USER_PATHS = NO;
ARCHS = "$(ARCHS_STANDARD_32_BIT)";
CLANG_ENABLE_OBJC_ARC = YES;
+ CLANG_WARN_OBJCPP_ARC_ABI = YES;
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
COPY_PHASE_STRIP = YES;
GCC_C_LANGUAGE_STANDARD = gnu99;
+ GCC_TREAT_WARNINGS_AS_ERRORS = YES;
GCC_VERSION = com.apple.compilers.llvm.clang.1_0;
GCC_WARN_ABOUT_RETURN_TYPE = YES;
GCC_WARN_UNINITIALIZED_AUTOS = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 5.1;
OTHER_CFLAGS = "-DNS_BLOCK_ASSERTIONS=1";
+ RUN_CLANG_STATIC_ANALYZER = YES;
SDKROOT = iphoneos;
VALIDATE_PRODUCT = YES;
};
@@ -289,6 +299,7 @@
B22B8549156528300001A7C2 /* Release */,
);
defaultConfigurationIsVisible = 0;
+ defaultConfigurationName = Release;
};
/* End XCConfigurationList section */
};
@@ -12,8 +12,7 @@
@interface AppDelegate : UIResponder <UIApplicationDelegate>
-@property (strong, nonatomic) UIWindow *window;
-
-@property (strong, nonatomic) ViewController *viewController;
+@property (nonatomic) UIWindow *window;
+@property (nonatomic) ViewController *viewController;
@end
@@ -12,9 +12,6 @@
@implementation AppDelegate
-@synthesize window = _window;
-@synthesize viewController = _viewController;
-
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
@@ -25,31 +22,4 @@ - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(
return YES;
}
-- (void)applicationWillResignActive:(UIApplication *)application
-{
- // Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state.
- // Use this method to pause ongoing tasks, disable timers, and throttle down OpenGL ES frame rates. Games should use this method to pause the game.
-}
-
-- (void)applicationDidEnterBackground:(UIApplication *)application
-{
- // Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later.
- // If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits.
-}
-
-- (void)applicationWillEnterForeground:(UIApplication *)application
-{
- // Called as part of the transition from the background to the inactive state; here you can undo many of the changes made on entering the background.
-}
-
-- (void)applicationDidBecomeActive:(UIApplication *)application
-{
- // Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface.
-}
-
-- (void)applicationWillTerminate:(UIApplication *)application
-{
- // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:.
-}
-
@end
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@@ -10,6 +10,6 @@
@interface ViewController : UIViewController
-@property (nonatomic, strong) IBOutlet UIImageView *imageView;
+@property (nonatomic) IBOutlet UIImageView *imageView;
@end
@@ -12,16 +12,13 @@
@interface ViewController () <UIAlertViewDelegate>
-@property (nonatomic, strong) NSURLAuthenticationChallenge *challenge;
+@property (nonatomic) NSURLAuthenticationChallenge *challenge;
@end
@implementation ViewController
-@synthesize imageView;
-@synthesize challenge;
-
- (void)viewDidLoad
{
[super viewDidLoad];
@@ -32,9 +29,9 @@ - (void)viewDidLoad
RQOperation *operation = [RQOperation operationWithRequest:request];
//add auth handler
- operation.authenticationChallengeHandler = ^(NSURLAuthenticationChallenge *_challenge)
+ operation.authenticationChallengeHandler = ^(NSURLAuthenticationChallenge *challenge)
{
- challenge = _challenge;
+ _challenge = challenge;
[[[UIAlertView alloc] initWithTitle:@"Challenge Receiver" message:@"Send credentials?" delegate:self cancelButtonTitle:@"Cancel" otherButtonTitles:@"Send", nil] show];
};
@@ -49,7 +46,7 @@ - (void)viewDidLoad
else
{
//set image
- imageView.image = [UIImage imageWithData:data];
+ _imageView.image = [UIImage imageWithData:data];
}
};
@@ -62,7 +59,7 @@ - (void)alertView:(UIAlertView *)alertView didDismissWithButtonIndex:(NSInteger)
if (buttonIndex == alertView.cancelButtonIndex)
{
//don't send credentials
- [challenge.sender continueWithoutCredentialForAuthenticationChallenge:challenge];
+ [_challenge.sender continueWithoutCredentialForAuthenticationChallenge:_challenge];
}
else
{
@@ -71,7 +68,7 @@ - (void)alertView:(UIAlertView *)alertView didDismissWithButtonIndex:(NSInteger)
password:@"test"
persistence:NSURLCredentialPersistenceNone];
//send credential
- [challenge.sender useCredential:credential forAuthenticationChallenge:challenge];
+ [_challenge.sender useCredential:credential forAuthenticationChallenge:_challenge];
}
}
@@ -10,8 +10,8 @@
@interface ImageLoaderAppDelegate : NSObject <UIApplicationDelegate>
-@property (nonatomic, retain) IBOutlet UIWindow *window;
-@property (nonatomic, retain) IBOutlet UINavigationController *navigationController;
+@property (nonatomic, strong) IBOutlet UIWindow *window;
+@property (nonatomic, strong) IBOutlet UINavigationController *navigationController;
@end
@@ -15,24 +15,12 @@ @implementation ImageLoaderAppDelegate
@synthesize window;
@synthesize navigationController;
-#pragma mark Application lifecycle
-
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
[window addSubview:[navigationController view]];
[window makeKeyAndVisible];
return YES;
}
-#pragma mark Memory management
-
-- (void)dealloc
-{
- [navigationController release];
- [window release];
- [super dealloc];
-}
-
-
@end
@@ -10,7 +10,7 @@
@interface RootViewController : UITableViewController
-@property (nonatomic, retain) UIBarButtonItem *loadUnloadButton;
+@property (nonatomic, strong) UIBarButtonItem *loadUnloadButton;
- (IBAction)loadUnloadImages;
@@ -12,8 +12,8 @@
@interface RootViewController ()
-@property (nonatomic, retain) NSMutableArray *urlStrings;
-@property (nonatomic, retain) NSMutableDictionary *images;
+@property (nonatomic, strong) NSMutableArray *urlStrings;
+@property (nonatomic, strong) NSMutableDictionary *images;
@end
@@ -30,10 +30,10 @@ - (void)viewDidLoad
{
[super viewDidLoad];
- self.loadUnloadButton = [[[UIBarButtonItem alloc] initWithTitle:@"Load"
+ self.loadUnloadButton = [[UIBarButtonItem alloc] initWithTitle:@"Load"
style:UIBarButtonItemStylePlain
target:self
- action:@selector(loadUnloadImages)] autorelease];
+ action:@selector(loadUnloadImages)];
self.navigationItem.rightBarButtonItem = loadUnloadButton;
self.navigationItem.title = @"Images";
@@ -99,20 +99,20 @@ - (void)loadUnloadImages
UIImage *image = [UIImage imageWithData:data];
if (image)
{
- [images setObject:image forKey:urlString];
+ images[urlString] = image;
}
else
{
//image error
NSInteger index = [urlStrings indexOfObject:urlString];
- [urlStrings replaceObjectAtIndex:index withObject:@"Image was missing or corrupt"];
+ urlStrings[index] = @"Image was missing or corrupt";
}
}
else
{
//loading error
NSInteger index = [urlStrings indexOfObject:urlString];
- [urlStrings replaceObjectAtIndex:index withObject:[error localizedDescription]];
+ urlStrings[index] = [error localizedDescription];
}
//refresh view
@@ -137,11 +137,11 @@ - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(N
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
if (cell == nil)
{
- cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier] autorelease];
+ cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier];
}
- NSString *urlString = [urlStrings objectAtIndex:indexPath.row];
- cell.imageView.image = [images objectForKey:urlString];
+ NSString *urlString = urlStrings[indexPath.row];
+ cell.imageView.image = images[urlString];
cell.textLabel.text = [urlString lastPathComponent];
return cell;
@@ -155,15 +155,13 @@ - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath
UIViewController *viewController = [[UIViewController alloc] init];
//set view
- NSString *urlString = [urlStrings objectAtIndex:indexPath.row];
- UIImage *image = [images objectForKey:urlString];
+ NSString *urlString = urlStrings[indexPath.row];
+ UIImage *image = images[urlString];
UIImageView *imageView = [[UIImageView alloc] initWithImage:image];
viewController.view = imageView;
- [imageView release];
//pass the selected object to the new view controller.
[self.navigationController pushViewController:viewController animated:YES];
- [viewController release];
}
#pragma mark Memory management
@@ -174,13 +172,6 @@ - (void)viewDidUnload
[super viewDidUnload];
}
-- (void)dealloc
-{
- [loadUnloadButton release];
- [urlStrings release];
- [images release];
- [super dealloc];
-}
@end
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Oops, something went wrong.

0 comments on commit bf3124f

Please sign in to comment.