Permalink
Browse files

move to ARC

  • Loading branch information...
1 parent 2829f74 commit 1f1dae963e9312f97a287c9ac2fe3f0b82f73907 @emilwojtaszek emilwojtaszek committed Oct 10, 2011
Showing with 90 additions and 170 deletions.
  1. +4 −0 Examples/Cascade/Cascade.xcodeproj/project.pbxproj
  2. +2 −2 Examples/Cascade/Cascade/CascadeAppDelegate.h
  3. +0 −8 Examples/Cascade/Cascade/CascadeAppDelegate.m
  4. +2 −8 Examples/Cascade/Cascade/ExampleCategoriesViewController.m
  5. +4 −5 Examples/Cascade/Cascade/ExampleNavigationController.m
  6. +0 −5 Examples/Cascade/Cascade/ExampleSplitCascadeViewController.m
  7. +1 −7 Examples/Cascade/Cascade/ExampleTableViewController.m
  8. +1 −2 Examples/Cascade/Cascade/ExampleWebViewController.m
  9. +4 −4 Examples/Cascade/Cascade/main.m
  10. +6 −0 src/Cascade/Cascade.xcodeproj/project.pbxproj
  11. +1 −1 src/Cascade/Cascade/CLCascadeNavigationController.h
  12. +3 −4 src/Cascade/Cascade/CLCascadeNavigationController.m
  13. +4 −4 src/Cascade/Cascade/CLCascadeView.h
  14. +3 −4 src/Cascade/Cascade/CLCascadeView.m
  15. +0 −4 src/Cascade/Cascade/CLCategoriesView.m
  16. +1 −7 src/Cascade/Cascade/CLCategoriesViewController.m
  17. +3 −21 src/Cascade/Cascade/CLSegmentedView.h
  18. +10 −15 src/Cascade/Cascade/CLSegmentedView.m
  19. +5 −5 src/Cascade/Cascade/CLSplitCascadeView.h
  20. +11 −16 src/Cascade/Cascade/CLSplitCascadeView.m
  21. +2 −2 src/Cascade/Cascade/CLSplitCascadeViewController.h
  22. +4 −8 src/Cascade/Cascade/CLSplitCascadeViewController.m
  23. +1 −1 src/Cascade/Cascade/CLTableViewController.h
  24. +1 −7 src/Cascade/Cascade/CLTableViewController.m
  25. +1 −1 src/Cascade/Cascade/CLViewController.h
  26. +2 −4 src/Cascade/Cascade/CLViewController.m
  27. +2 −2 src/Cascade/Cascade/CLWebViewController.h
  28. +6 −9 src/Cascade/Cascade/CLWebViewController.m
  29. +2 −2 src/Cascade/Cascade/CascadeAppDelegate.h
  30. +0 −8 src/Cascade/Cascade/CascadeAppDelegate.m
  31. +4 −4 src/Cascade/Cascade/main.m
@@ -476,10 +476,12 @@
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
+ CLANG_ENABLE_OBJC_ARC = YES;
COPY_PHASE_STRIP = NO;
GCC_DYNAMIC_NO_PIC = NO;
GCC_PRECOMPILE_PREFIX_HEADER = YES;
GCC_PREFIX_HEADER = "Cascade/Cascade-Prefix.pch";
+ GCC_VERSION = com.apple.compilers.llvm.clang.1_0;
INFOPLIST_FILE = "Cascade/Cascade-Info.plist";
IPHONEOS_DEPLOYMENT_TARGET = 4.2;
PRODUCT_NAME = "$(TARGET_NAME)";
@@ -491,9 +493,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 = "Cascade/Cascade-Prefix.pch";
+ GCC_VERSION = com.apple.compilers.llvm.clang.1_0;
INFOPLIST_FILE = "Cascade/Cascade-Info.plist";
IPHONEOS_DEPLOYMENT_TARGET = 4.2;
PRODUCT_NAME = "$(TARGET_NAME)";
@@ -14,7 +14,7 @@
}
-@property (nonatomic, retain) IBOutlet UIWindow *window;
-@property (nonatomic, retain) IBOutlet CLSplitCascadeViewController *viewController;
+@property (nonatomic, strong) IBOutlet UIWindow *window;
+@property (nonatomic, strong) IBOutlet CLSplitCascadeViewController *viewController;
@end
@@ -27,8 +27,6 @@ - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(
[self.viewController setCategoriesViewController: categoriesViewController];
[self.viewController setCascadeNavigationController: cascadeNavigationController];
- [categoriesViewController release];
- [cascadeNavigationController release];
// Override point for customization after application launch.
self.window.rootViewController = self.viewController;
@@ -76,11 +74,5 @@ - (void)applicationWillTerminate:(UIApplication *)application
*/
}
-- (void)dealloc
-{
- [_window release];
- [_viewController release];
- [super dealloc];
-}
@end
@@ -20,10 +20,6 @@ - (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
return self;
}
-- (void)dealloc
-{
- [super dealloc];
-}
- (void)didReceiveMemoryWarning
{
@@ -47,7 +43,6 @@ - (void)viewDidLoad
UIView* backgrounView = [[UIView alloc] initWithFrame: self.tableView.bounds];
[backgrounView setBackgroundColor:[UIColor colorWithPatternImage:[UIImage imageNamed:@"brown_bg_128x128.png"]]];
[self.tableView setBackgroundView:backgrounView];
- [backgrounView release];
}
- (void)viewDidUnload
@@ -88,15 +83,15 @@ - (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];
[cell.textLabel setFont:[UIFont fontWithName:@"HelveticaNeue-Bold" size:17.0]];
[cell.textLabel setTextColor: [UIColor colorWithRed:0.894117 green:0.839215 blue:0.788235 alpha:1.0]];
[cell.textLabel setShadowColor: [UIColor colorWithRed:0.0 green:0.0 blue:0.0 alpha:0.75]];
[cell.textLabel setShadowOffset:CGSizeMake(0.0, 1.0)];
UIImage *backgroundImage = [[UIImage imageNamed:@"LightBackground.png"] stretchableImageWithLeftCapWidth:0.0 topCapHeight:1.0];
- cell.backgroundView = [[[UIImageView alloc] initWithImage:backgroundImage] autorelease];
+ cell.backgroundView = [[UIImageView alloc] initWithImage:backgroundImage];
cell.backgroundView.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight;
cell.backgroundView.frame = cell.bounds;
cell.backgroundView.alpha = 0.5;
@@ -115,7 +110,6 @@ - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath
// if you select row, then create and push custom UIViewController
ExampleTableViewController* rootTableViewController = [[ExampleTableViewController alloc] initWithTableViewStyle: UITableViewStylePlain];
[self.cascadeNavigationController setRootViewController:rootTableViewController animated:YES];
- [rootTableViewController release];
}
@@ -18,10 +18,9 @@ @implementation ExampleNavigationController
static CGFloat kTopOffset = 10.0f;
- (void)dealloc {
- [_staticDetachImage release], _staticDetachImage = nil;
- [_dynamicDetachImage release], _dynamicDetachImage = nil;
+ _staticDetachImage = nil;
+ _dynamicDetachImage = nil;
- [super dealloc];
}
///////////////////////////////////////////////////////////////////////////////////////////////////
@@ -51,8 +50,8 @@ - (void)viewDidLoad {
- (void)viewDidUnload {
[super viewDidUnload];
- [_staticDetachImage release], _staticDetachImage = nil;
- [_dynamicDetachImage release], _dynamicDetachImage = nil;
+ _staticDetachImage = nil;
+ _dynamicDetachImage = nil;
}
///////////////////////////////////////////////////////////////////////////////////////////////////
@@ -11,10 +11,6 @@
@implementation ExampleSplitCascadeViewController
///////////////////////////////////////////////////////////////////////////////////////////////////
-- (void)dealloc
-{
- [super dealloc];
-}
///////////////////////////////////////////////////////////////////////////////////////////////////
@@ -45,7 +41,6 @@ - (void) viewDidLoad {
UIView* backgroundView = [[UIView alloc] init];
[backgroundView setBackgroundColor: [UIColor colorWithPatternImage: [UIImage imageNamed: @"brown_bg_128x128"]]];
[self setBackgroundView:backgroundView];
- [backgroundView release];
// add divider
UIImage* divider = [UIImage imageNamed:@"divider_vertical.png"];
@@ -13,10 +13,6 @@ @implementation ExampleTableViewController
///////////////////////////////////////////////////////////////////////////////////////////////////
-- (void)dealloc
-{
- [super dealloc];
-}
///////////////////////////////////////////////////////////////////////////////////////////////////
- (void)didReceiveMemoryWarning
@@ -41,7 +37,6 @@ - (void)viewDidLoad
UIImageView* header = [[UIImageView alloc] initWithFrame: CGRectMake(0.0, 0.0, self.view.bounds.size.width, 45.0)];
[header setImage: [UIImage imageNamed:@"ToolBar_479x45.png"]];
[self.segmentedView setHeaderView: header];
- [header release];
// show rounded corners
[self setShowRoundedCorners: NO];
@@ -90,7 +85,7 @@ - (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];
}
// Configure the cell...
@@ -118,7 +113,6 @@ - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath
}
[self pushDetailViewController:viewController animated:YES];
- [viewController release];
}
@end
@@ -41,7 +41,6 @@ - (void)viewDidLoad
UIImageView* header = [[UIImageView alloc] initWithFrame: CGRectMake(0.0, 0.0, self.view.bounds.size.width, 45.0)];
[header setImage: [UIImage imageNamed:@"ToolBar_479x45.png"]];
[self.segmentedView setHeaderView: header];
- [header release];
// show rounded corners
[self setShowRoundedCorners: NO];
@@ -63,7 +62,7 @@ - (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interface
///////////////////////////////////////////////////////////////////////////////////////////////////
- (NSURLRequest*) request {
- NSURL* url = [NSURL URLWithString: @"https://github.com/creativelabs/CLCascade"];
+ NSURL* url = [NSURL URLWithString: @"https://github.com/appunite/CLCascade"];
return [NSURLRequest requestWithURL:url
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:30.0];
@@ -10,8 +10,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;
+ }
}
@@ -12,6 +12,7 @@
20015598138F82FC00FA91B2 /* CLCascadeView.m in Sources */ = {isa = PBXBuildFile; fileRef = 20015595138F824E00FA91B2 /* CLCascadeView.m */; };
200BF67F13747494005C23EF /* CLCategoriesViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 200BF67E13747494005C23EF /* CLCategoriesViewController.m */; };
200BF6821374751B005C23EF /* CLCascadeNavigationController.m in Sources */ = {isa = PBXBuildFile; fileRef = 200BF6811374751B005C23EF /* CLCascadeNavigationController.m */; };
+ 200DCD1C1443657300E4E686 /* CLBorderShadowView.m in Sources */ = {isa = PBXBuildFile; fileRef = 20CCD4D71403D2D70067CEC6 /* CLBorderShadowView.m */; };
201EAFC813F5402C0069E9F3 /* CLScrollView.m in Sources */ = {isa = PBXBuildFile; fileRef = 2026954413E3034500EF60A6 /* CLScrollView.m */; };
201EAFD113F5517F0069E9F3 /* CLGlobal.h in Headers */ = {isa = PBXBuildFile; fileRef = 201EAFD013F5517F0069E9F3 /* CLGlobal.h */; };
2026954513E3034500EF60A6 /* CLScrollView.h in Headers */ = {isa = PBXBuildFile; fileRef = 2026954313E3034500EF60A6 /* CLScrollView.h */; };
@@ -473,6 +474,7 @@
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
files = (
+ 200DCD1C1443657300E4E686 /* CLBorderShadowView.m in Sources */,
201EAFC813F5402C0069E9F3 /* CLScrollView.m in Sources */,
20015598138F82FC00FA91B2 /* CLCascadeView.m in Sources */,
20BB342B133FB8FF003EEB6E /* main.m in Sources */,
@@ -601,11 +603,13 @@
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
+ CLANG_ENABLE_OBJC_ARC = YES;
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer: Tadeusz Wojtaszek (R7VEB36U8D)";
COPY_PHASE_STRIP = NO;
GCC_DYNAMIC_NO_PIC = NO;
GCC_PRECOMPILE_PREFIX_HEADER = YES;
GCC_PREFIX_HEADER = "Cascade/Cascade-Prefix.pch";
+ GCC_VERSION = com.apple.compilers.llvm.clang.1_0;
HEADER_SEARCH_PATHS = "";
INFOPLIST_FILE = "Cascade/Cascade-Info.plist";
IPHONEOS_DEPLOYMENT_TARGET = 4.2;
@@ -621,10 +625,12 @@
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
+ CLANG_ENABLE_OBJC_ARC = YES;
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer: Tadeusz Wojtaszek (R7VEB36U8D)";
COPY_PHASE_STRIP = YES;
GCC_PRECOMPILE_PREFIX_HEADER = YES;
GCC_PREFIX_HEADER = "Cascade/Cascade-Prefix.pch";
+ GCC_VERSION = com.apple.compilers.llvm.clang.1_0;
HEADER_SEARCH_PATHS = "";
INFOPLIST_FILE = "Cascade/Cascade-Info.plist";
IPHONEOS_DEPLOYMENT_TARGET = 4.2;
@@ -24,7 +24,7 @@
/*
List of CLViewControllers on stock.
*/
-@property (nonatomic, retain, readonly) NSMutableArray* viewControllers;
+@property (nonatomic, strong, readonly) NSMutableArray* viewControllers;
/*
* Left inset of normal size pages from left boarder
@@ -29,9 +29,8 @@ - (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
- (void)dealloc
{
- [_viewControllers release], _viewControllers = nil;
- [_cascadeView release], _cascadeView = nil;
- [super dealloc];
+ _viewControllers = nil;
+ _cascadeView = nil;
}
- (void)didReceiveMemoryWarning
@@ -65,7 +64,7 @@ - (void)viewDidUnload
// Release any retained subviews of the main view.
// e.g. self.myOutlet = nil;
[_cascadeView removeFromSuperview];
- [_cascadeView release], _cascadeView = nil;
+ _cascadeView = nil;
}
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
@@ -14,8 +14,8 @@
@interface CLCascadeView : UIView <UIScrollViewDelegate> {
// delegate and dataSource
- id<CLCascadeViewDelegate> _delegate;
- id<CLCascadeViewDataSource> _dataSource;
+ id<CLCascadeViewDelegate> __unsafe_unretained _delegate;
+ id<CLCascadeViewDataSource> __unsafe_unretained _dataSource;
// scroll view
CLScrollView* _scrollView;
@@ -41,8 +41,8 @@
NSInteger _indexOfLastVisiblePage;
}
-@property(nonatomic, assign) id<CLCascadeViewDelegate> delegate;
-@property(nonatomic, assign) id<CLCascadeViewDataSource> dataSource;
+@property(nonatomic, unsafe_unretained) id<CLCascadeViewDelegate> delegate;
+@property(nonatomic, unsafe_unretained) id<CLCascadeViewDataSource> dataSource;
/*
* Left inset of normal page from left boarder. Default 58.0f
@@ -72,9 +72,8 @@ - (void)dealloc
{
_delegate = nil;
_dataSource = nil;
- [_scrollView release], _scrollView = nil;
- [_pages release], _pages = nil;
- [super dealloc];
+ _scrollView = nil;
+ _pages = nil;
}
@@ -194,7 +193,7 @@ - (void) pushPage:(UIView*)newPage fromPage:(UIView*)fromPage animated:(BOOL)ani
///////////////////////////////////////////////////////////////////////////////////////////////////
- (void) popPageAtIndex:(NSInteger)index animated:(BOOL)animated {
// get item at index
- __block id item = [_pages objectAtIndex:index];
+ __unsafe_unretained id item = [_pages objectAtIndex:index];
// check if page is unloaded
if (item != [NSNull null]) {
@@ -20,9 +20,5 @@ - (id)initWithFrame:(CGRect)frame
return self;
}
-- (void)dealloc
-{
- [super dealloc];
-}
@end
@@ -28,10 +28,6 @@ - (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
return self;
}
-- (void)dealloc
-{
- [super dealloc];
-}
- (void)didReceiveMemoryWarning
{
@@ -63,13 +59,11 @@ - (void)loadView
CLCategoriesView* view_ = [[CLCategoriesView alloc] init];
self.view = view_;
- [view_ release];
UITableView* tableView_ = [[UITableView alloc] initWithFrame:CGRectZero style:_tableViewStyle];
[tableView_ setDelegate: self];
[tableView_ setDataSource: self];
[self setTableView: tableView_];
- [tableView_ release];
// set clear background color
[view_ setBackgroundColor: [UIColor clearColor]];
@@ -120,7 +114,7 @@ - (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];
}
return cell;
Oops, something went wrong.

0 comments on commit 1f1dae9

Please sign in to comment.