Skip to content
Browse files

Converted project to a framework, added compatibility with Xcode4/iOS…

…5/ARC projects
  • Loading branch information...
1 parent e2795fd commit 10ac447cb77b8b7fea315b715144238bd8da0675 @AliSoftware committed Oct 22, 2011
View
1 .gitignore
@@ -1,4 +1,5 @@
# xcode noise
+xcuserdata/
build/
*~.nib/
*.pbxuser
View
4 GridViewExample/Classes/GridViewExampleAppDelegate.h
@@ -15,8 +15,8 @@
GridViewExampleViewController *viewController;
}
-@property (nonatomic, retain) IBOutlet UIWindow *window;
-@property (nonatomic, retain) IBOutlet GridViewExampleViewController *viewController;
+@property (nonatomic, arc_strong) IBOutlet UIWindow *window;
+@property (nonatomic, arc_strong) IBOutlet GridViewExampleViewController *viewController;
@end
View
4 GridViewExample/Classes/GridViewExampleAppDelegate.m
@@ -29,12 +29,12 @@ - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(
return YES;
}
-
+#if ! ARC_ENABLED
- (void)dealloc {
[viewController release];
[window release];
[super dealloc];
}
-
+#endif
@end
View
13 GridViewExample/Classes/GridViewExampleViewController.m
@@ -33,10 +33,10 @@ -(OHGridViewCell*)gridView:(OHGridView *)aGridView cellAtIndexPath:(NSIndexPath
//cell.backgroundColor = [UIColor grayColor]; // One way
// Another way, using custom view (so you may also user an UIImageView or whatever you need
- cell.backgroundView = [[[UIView alloc] initWithFrame:CGRectZero] autorelease];
+ cell.backgroundView = noarc_autorelease([[UIView alloc] initWithFrame:CGRectZero]);
cell.backgroundView.backgroundColor = [UIColor colorWithRed:0.5f green:0.8f blue:0.5f alpha:1.f];
- cell.selectedBackgroundView = [[[UIView alloc] initWithFrame:CGRectZero] autorelease];
+ cell.selectedBackgroundView = noarc_autorelease([[UIView alloc] initWithFrame:CGRectZero]);
cell.selectedBackgroundView.backgroundColor = [UIColor colorWithRed:0.5f green:0.5f blue:0.8f alpha:1.f];
}
@@ -50,9 +50,12 @@ -(OHGridViewCell*)gridView:(OHGridView *)aGridView cellAtIndexPath:(NSIndexPath
-(void)gridView:(OHGridView *)aGridView didSelectCellAtIndexPath:(NSIndexPath *)indexPath {
NSUInteger idx = [aGridView indexForIndexPath:indexPath];
NSString* msg = [items objectAtIndex:idx];
- UIAlertView* alert = [[UIAlertView alloc] initWithTitle:@"Tap" message:msg delegate:self cancelButtonTitle:@"OK" otherButtonTitles:nil];
+ UIAlertView* alert = noarc_autorelease([[UIAlertView alloc] initWithTitle:@"Tap"
+ message:msg
+ delegate:self
+ cancelButtonTitle:@"OK"
+ otherButtonTitles:nil]);
[alert show];
- [alert release];
}
-(void)alertView:(UIAlertView *)alertView didDismissWithButtonIndex:(NSInteger)buttonIndex {
[(OHGridView*)self.view deselectSelectedCellsAnimated:YES];
@@ -66,7 +69,7 @@ - (void)willAnimateRotationToInterfaceOrientation:(UIInterfaceOrientation)interf
}
-(void)viewDidUnload {
- [items release];
+ noarc_release(items);
items = nil;
}
View
4 GridViewExample/GridViewExample.xcodeproj/project.pbxproj
@@ -22,14 +22,14 @@
098D5676123022DA0055E596 /* weather-64x64.png in Resources */ = {isa = PBXBuildFile; fileRef = 098D5669123022DA0055E596 /* weather-64x64.png */; };
09BAC51712E255DF00C3B95B /* Icon.png in Resources */ = {isa = PBXBuildFile; fileRef = 09BAC51612E255DF00C3B95B /* Icon.png */; };
09E8E6F8145315DD00C63E20 /* OHGridView.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 09E8E6F7145315DD00C63E20 /* OHGridView.framework */; };
- 1D3623260D0F684500981E51 /* GridViewExampleAppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 1D3623250D0F684500981E51 /* GridViewExampleAppDelegate.m */; settings = {COMPILER_FLAGS = "-fno-objc-arc"; }; };
+ 1D3623260D0F684500981E51 /* GridViewExampleAppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 1D3623250D0F684500981E51 /* GridViewExampleAppDelegate.m */; };
1D60589B0D05DD56006BFB54 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 29B97316FDCFA39411CA2CEA /* main.m */; };
1D60589F0D05DD5A006BFB54 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1D30AB110D05D00D00671497 /* Foundation.framework */; };
1DF5F4E00D08C38300B7A737 /* UIKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1DF5F4DF0D08C38300B7A737 /* UIKit.framework */; };
288765A50DF7441C002DB57D /* CoreGraphics.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 288765A40DF7441C002DB57D /* CoreGraphics.framework */; };
2899E5220DE3E06400AC0155 /* GridViewExampleViewController.xib in Resources */ = {isa = PBXBuildFile; fileRef = 2899E5210DE3E06400AC0155 /* GridViewExampleViewController.xib */; };
28AD733F0D9D9553002E5188 /* MainWindow.xib in Resources */ = {isa = PBXBuildFile; fileRef = 28AD733E0D9D9553002E5188 /* MainWindow.xib */; };
- 28D7ACF80DDB3853001CB0EB /* GridViewExampleViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 28D7ACF70DDB3853001CB0EB /* GridViewExampleViewController.m */; settings = {COMPILER_FLAGS = "-fno-objc-arc"; }; };
+ 28D7ACF80DDB3853001CB0EB /* GridViewExampleViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 28D7ACF70DDB3853001CB0EB /* GridViewExampleViewController.m */; };
/* End PBXBuildFile section */
/* Begin PBXContainerItemProxy section */
View
7 GridViewExample/GridViewExample.xcodeproj/project.xcworkspace/contents.xcworkspacedata
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<Workspace
+ version = "1.0">
+ <FileRef
+ location = "self:GridViewExample.xcodeproj">
+ </FileRef>
+</Workspace>
View
16 GridViewExample/GridViewExample_Prefix.pch
@@ -6,3 +6,19 @@
#import <Foundation/Foundation.h>
#import <UIKit/UIKit.h>
#endif
+
+#ifndef __has_feature
+ #define ARC_ENABLED 0
+#else
+ #define ARC_ENABLED __has_feature(objc_arc)
+#endif
+
+#if ARC_ENABLED
+ #define noarc_release(x)
+ #define noarc_autorelease(x) x
+ #define arc_strong strong
+#else
+ #define noarc_release(x) [x release]
+ #define noarc_autorelease(x) [x autorelease]
+ #define arc_strong retain
+#endif
View
2 GridViewExample/main.m
@@ -9,7 +9,7 @@
#import <UIKit/UIKit.h>
int main(int argc, char *argv[]) {
-#if 1
+#if ARC_ENABLED
@autoreleasepool {
return UIApplicationMain(argc, argv, nil, nil);
}
View
BIN ...odeproj/project.xcworkspace/xcuserdata/olivier.xcuserdatad/UserInterfaceState.xcuserstate
Binary file not shown.
View
32 ...ew/OHGridView.xcodeproj/xcuserdata/olivier.xcuserdatad/xcschemes/xcschememanagement.plist
@@ -1,32 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
-<plist version="1.0">
-<dict>
- <key>SchemeUserState</key>
- <dict>
- <key>Universal Framework.xcscheme_^#shared#^_</key>
- <dict>
- <key>orderHint</key>
- <integer>2</integer>
- </dict>
- </dict>
- <key>SuppressBuildableAutocreation</key>
- <dict>
- <key>09E8E6BF14530B5400C63E20</key>
- <dict>
- <key>primary</key>
- <true/>
- </dict>
- <key>09E8E6D314530BA300C63E20</key>
- <dict>
- <key>primary</key>
- <true/>
- </dict>
- <key>09E8E6EB145311CF00C63E20</key>
- <dict>
- <key>primary</key>
- <true/>
- </dict>
- </dict>
-</dict>
-</plist>

0 comments on commit 10ac447

Please sign in to comment.
Something went wrong with that request. Please try again.