Permalink
Browse files

Updated project to ARC

  • Loading branch information...
nacho4d committed May 30, 2012
1 parent f029426 commit 59c9ee4d66dd7a8981ca41f5e78007df46c6fa0a
@@ -16,8 +16,8 @@
ClockViewController *viewController;
}
-@property (nonatomic, retain) IBOutlet UIWindow *window;
-@property (nonatomic, retain) IBOutlet ClockViewController *viewController;
+@property (nonatomic, strong) IBOutlet UIWindow *window;
+@property (nonatomic, strong) IBOutlet ClockViewController *viewController;
@end
@@ -62,11 +62,6 @@ Free up as much memory as possible by purging cached data objects that can be re
}
-- (void)dealloc {
- [viewController release];
- [window release];
- [super dealloc];
-}
@end
View
@@ -36,7 +36,7 @@ - (void)setHourHandImage:(CGImageRef)image
hourHand.cornerRadius = 0.0;
}
- hourHand.contents = (id)image;
+ hourHand.contents = (__bridge id)image;
}
- (void)setMinHandImage:(CGImageRef)image
@@ -46,7 +46,7 @@ - (void)setMinHandImage:(CGImageRef)image
}else{
minHand.backgroundColor = [UIColor clearColor].CGColor;
}
- minHand.contents = (id)image;
+ minHand.contents = (__bridge id)image;
}
- (void)setSecHandImage:(CGImageRef)image
@@ -60,7 +60,7 @@ - (void)setSecHandImage:(CGImageRef)image
secHand.borderWidth = 0.0;
secHand.borderColor = [UIColor clearColor].CGColor;
}
- secHand.contents = (id)image;
+ secHand.contents = (__bridge id)image;
}
- (void)setClockBackgroundImage:(CGImageRef)image
@@ -74,7 +74,7 @@ - (void)setClockBackgroundImage:(CGImageRef)image
containerLayer.borderWidth = 0.0;
containerLayer.cornerRadius = 0.0;
}
- containerLayer.contents = (id)image;
+ containerLayer.contents = (__bridge id)image;
}
#pragma mark - Private Methods
@@ -134,26 +134,26 @@ - (void) layoutSubviews
w = HOURS_HAND_WIDTH;
h = length*HOURS_HAND_LENGTH;
}else{
- w = CGImageGetWidth((CGImageRef)hourHand.contents)/scale;
- h = CGImageGetHeight((CGImageRef)hourHand.contents)/scale;
+ w = CGImageGetWidth((__bridge CGImageRef)hourHand.contents)/scale;
+ h = CGImageGetHeight((__bridge CGImageRef)hourHand.contents)/scale;
}
hourHand.bounds = CGRectMake(0,0,w,h);
if (minHand.contents == NULL){
w = MIN_HAND_WIDTH;
h = length*MIN_HAND_LENGTH;
}else{
- w = CGImageGetWidth((CGImageRef)minHand.contents)/scale;
- h = CGImageGetHeight((CGImageRef)minHand.contents)/scale;
+ w = CGImageGetWidth((__bridge CGImageRef)minHand.contents)/scale;
+ h = CGImageGetHeight((__bridge CGImageRef)minHand.contents)/scale;
}
minHand.bounds = CGRectMake(0,0,w,h);
if (secHand.contents == NULL){
w = SEC_HAND_WIDTH;
h = length*SEC_HAND_LENGTH;
}else{
- w = CGImageGetWidth((CGImageRef)secHand.contents)/scale;
- h = CGImageGetHeight((CGImageRef)secHand.contents)/scale;
+ w = CGImageGetWidth((__bridge CGImageRef)secHand.contents)/scale;
+ h = CGImageGetHeight((__bridge CGImageRef)secHand.contents)/scale;
}
secHand.bounds = CGRectMake(0,0,w,h);
@@ -168,10 +168,10 @@ - (id)initWithFrame:(CGRect)frame
self = [super initWithFrame:frame];
if (self) {
- containerLayer = [[CALayer layer] retain];
- hourHand = [[CALayer layer] retain];
- minHand = [[CALayer layer] retain];
- secHand = [[CALayer layer] retain];
+ containerLayer = [CALayer layer];
+ hourHand = [CALayer layer];
+ minHand = [CALayer layer];
+ secHand = [CALayer layer];
//default appearance
[self setClockBackgroundImage:NULL];
@@ -188,15 +188,15 @@ - (id)initWithFrame:(CGRect)frame
return self;
}
-- (void)dealloc
+- (void)removeFromSuperview
{
[self stop];
- [hourHand release];
- [minHand release];
- [secHand release];
- [containerLayer release];
+ [super removeFromSuperview];
+}
- [super dealloc];
+- (void)dealloc
+{
+ [self stop];
}
@end
@@ -14,7 +14,7 @@
{
}
-@property (nonatomic, retain) ClockView *clockView1;
-@property (nonatomic, retain) ClockView *clockView2;
+@property (nonatomic, strong) ClockView *clockView1;
+@property (nonatomic, strong) ClockView *clockView2;
@end
@@ -22,13 +22,6 @@ - (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
return self;
}
-- (void)dealloc
-{
- [clockView1 release];
- [clockView2 release];
- [super dealloc];
-}
-
- (void)didReceiveMemoryWarning
{
[super didReceiveMemoryWarning];
@@ -223,11 +223,13 @@
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
+ CLANG_ENABLE_OBJC_ARC = YES;
COPY_PHASE_STRIP = NO;
GCC_DYNAMIC_NO_PIC = NO;
GCC_OPTIMIZATION_LEVEL = 0;
GCC_PRECOMPILE_PREFIX_HEADER = YES;
GCC_PREFIX_HEADER = clock_Prefix.pch;
+ GCC_VERSION = com.apple.compilers.llvm.clang.1_0;
INFOPLIST_FILE = "clock-Info.plist";
PRODUCT_NAME = clock;
};
@@ -237,9 +239,11 @@
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
+ CLANG_ENABLE_OBJC_ARC = YES;
COPY_PHASE_STRIP = YES;
GCC_PRECOMPILE_PREFIX_HEADER = YES;
GCC_PREFIX_HEADER = clock_Prefix.pch;
+ GCC_VERSION = com.apple.compilers.llvm.clang.1_0;
INFOPLIST_FILE = "clock-Info.plist";
PRODUCT_NAME = clock;
VALIDATE_PRODUCT = YES;
View
@@ -11,8 +11,8 @@
int main(int argc, char *argv[]) {
- NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init];
- int retVal = UIApplicationMain(argc, argv, nil, nil);
- [pool release];
- return retVal;
+ @autoreleasepool {
+ int retVal = UIApplicationMain(argc, argv, nil, nil);
+ return retVal;
+ }
}

0 comments on commit 59c9ee4

Please sign in to comment.