Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enabled ARC #41

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@ - (void)viewDidLoad {
view.delegate = self;
[self.tableView addSubview:view];
_refreshHeaderView = view;
[view release];

}

Expand Down Expand Up @@ -69,7 +68,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.
Expand Down Expand Up @@ -157,7 +156,6 @@ - (void)viewDidUnload {
- (void)dealloc {

_refreshHeaderView = nil;
[super dealloc];
}


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@
UINavigationController *navigationController;
}

@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

Original file line number Diff line number Diff line change
Expand Up @@ -54,11 +54,6 @@ - (void)applicationWillTerminate:(UIApplication *)application {
#pragma mark -
#pragma mark Memory management

- (void)dealloc {
[navigationController release];
[window release];
[super dealloc];
}


@end
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ typedef enum{
@protocol EGORefreshTableHeaderDelegate;
@interface EGORefreshTableHeaderView : UIView {

id _delegate;
id __unsafe_unretained _delegate;
EGOPullRefreshState _state;

UILabel *_lastUpdatedLabel;
Expand All @@ -47,7 +47,7 @@ typedef enum{

}

@property(nonatomic,assign) id <EGORefreshTableHeaderDelegate> delegate;
@property(nonatomic,unsafe_unretained) id <EGORefreshTableHeaderDelegate> delegate;

- (void)refreshLastUpdatedDate;
- (void)egoRefreshScrollViewDidScroll:(UIScrollView *)scrollView;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,6 @@ - (id)initWithFrame:(CGRect)frame {
label.textAlignment = UITextAlignmentCenter;
[self addSubview:label];
_lastUpdatedLabel=label;
[label release];

label = [[UILabel alloc] initWithFrame:CGRectMake(0.0f, frame.size.height - 48.0f, self.frame.size.width, 20.0f)];
label.autoresizingMask = UIViewAutoresizingFlexibleWidth;
Expand All @@ -68,7 +67,6 @@ - (id)initWithFrame:(CGRect)frame {
label.textAlignment = UITextAlignmentCenter;
[self addSubview:label];
_statusLabel=label;
[label release];

CALayer *layer = [CALayer layer];
layer.frame = CGRectMake(25.0f, frame.size.height - 65.0f, 30.0f, 55.0f);
Expand All @@ -88,7 +86,6 @@ - (id)initWithFrame:(CGRect)frame {
view.frame = CGRectMake(25.0f, frame.size.height - 38.0f, 20.0f, 20.0f);
[self addSubview:view];
_activityView = view;
[view release];


[self setState:EGOOPullRefreshNormal];
Expand Down Expand Up @@ -116,7 +113,6 @@ - (void)refreshLastUpdatedDate {
_lastUpdatedLabel.text = [NSString stringWithFormat:@"Last Updated: %@", [formatter stringFromDate:date]];
[[NSUserDefaults standardUserDefaults] setObject:_lastUpdatedLabel.text forKey:@"EGORefreshTableView_LastRefresh"];
[[NSUserDefaults standardUserDefaults] synchronize];
[formatter release];

} else {

Expand Down Expand Up @@ -253,7 +249,6 @@ - (void)dealloc {
_statusLabel = nil;
_arrowImage = nil;
_lastUpdatedLabel = nil;
[super dealloc];
}


Expand Down
4 changes: 4 additions & 0 deletions Demo/TableViewPull/TableViewPull.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -264,11 +264,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 = TableViewPull_Prefix.pch;
GCC_VERSION = com.apple.compilers.llvm.clang.1_0;
INFOPLIST_FILE = "Resources/TableViewPull-Info.plist";
IPHONEOS_DEPLOYMENT_TARGET = 3.0;
PRODUCT_NAME = TableViewPull;
Expand All @@ -280,9 +282,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 = TableViewPull_Prefix.pch;
GCC_VERSION = com.apple.compilers.llvm.clang.1_0;
INFOPLIST_FILE = "Resources/TableViewPull-Info.plist";
IPHONEOS_DEPLOYMENT_TARGET = 3.0;
PRODUCT_NAME = TableViewPull;
Expand Down
8 changes: 4 additions & 4 deletions Demo/TableViewPull/main.m
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ typedef enum{
@protocol EGORefreshTableHeaderDelegate;
@interface EGORefreshTableHeaderView : UIView {

id _delegate;
id __unsafe_unretained _delegate;
EGOPullRefreshState _state;

UILabel *_lastUpdatedLabel;
Expand All @@ -47,9 +47,7 @@ typedef enum{

}

@property(nonatomic,assign) id <EGORefreshTableHeaderDelegate> delegate;

- (id)initWithFrame:(CGRect)frame arrowImageName:(NSString *)arrow textColor:(UIColor *)textColor;
@property(nonatomic,unsafe_unretained) id <EGORefreshTableHeaderDelegate> delegate;

- (void)refreshLastUpdatedDate;
- (void)egoRefreshScrollViewDidScroll:(UIScrollView *)scrollView;
Expand Down
28 changes: 10 additions & 18 deletions EGOTableViewPullRefresh/Classes/View/EGORefreshTableHeaderView.m
Original file line number Diff line number Diff line change
Expand Up @@ -40,40 +40,38 @@ @implementation EGORefreshTableHeaderView
@synthesize delegate=_delegate;


- (id)initWithFrame:(CGRect)frame arrowImageName:(NSString *)arrow textColor:(UIColor *)textColor {
if((self = [super initWithFrame:frame])) {
- (id)initWithFrame:(CGRect)frame {
if (self = [super initWithFrame:frame]) {

self.autoresizingMask = UIViewAutoresizingFlexibleWidth;
self.backgroundColor = [UIColor colorWithRed:226.0/255.0 green:231.0/255.0 blue:237.0/255.0 alpha:1.0];

UILabel *label = [[UILabel alloc] initWithFrame:CGRectMake(0.0f, frame.size.height - 30.0f, self.frame.size.width, 20.0f)];
label.autoresizingMask = UIViewAutoresizingFlexibleWidth;
label.font = [UIFont systemFontOfSize:12.0f];
label.textColor = textColor;
label.textColor = TEXT_COLOR;
label.shadowColor = [UIColor colorWithWhite:0.9f alpha:1.0f];
label.shadowOffset = CGSizeMake(0.0f, 1.0f);
label.backgroundColor = [UIColor clearColor];
label.textAlignment = UITextAlignmentCenter;
[self addSubview:label];
_lastUpdatedLabel=label;
[label release];

label = [[UILabel alloc] initWithFrame:CGRectMake(0.0f, frame.size.height - 48.0f, self.frame.size.width, 20.0f)];
label.autoresizingMask = UIViewAutoresizingFlexibleWidth;
label.font = [UIFont boldSystemFontOfSize:13.0f];
label.textColor = textColor;
label.textColor = TEXT_COLOR;
label.shadowColor = [UIColor colorWithWhite:0.9f alpha:1.0f];
label.shadowOffset = CGSizeMake(0.0f, 1.0f);
label.backgroundColor = [UIColor clearColor];
label.textAlignment = UITextAlignmentCenter;
[self addSubview:label];
_statusLabel=label;
[label release];

CALayer *layer = [CALayer layer];
layer.frame = CGRectMake(25.0f, frame.size.height - 65.0f, 30.0f, 55.0f);
layer.contentsGravity = kCAGravityResizeAspect;
layer.contents = (id)[UIImage imageNamed:arrow].CGImage;
layer.contents = (id)[UIImage imageNamed:@"blueArrow.png"].CGImage;

#if __IPHONE_OS_VERSION_MAX_ALLOWED >= 40000
if ([[UIScreen mainScreen] respondsToSelector:@selector(scale)]) {
Expand All @@ -88,7 +86,6 @@ - (id)initWithFrame:(CGRect)frame arrowImageName:(NSString *)arrow textColor:(UI
view.frame = CGRectMake(25.0f, frame.size.height - 38.0f, 20.0f, 20.0f);
[self addSubview:view];
_activityView = view;
[view release];


[self setState:EGOOPullRefreshNormal];
Expand All @@ -99,9 +96,6 @@ - (id)initWithFrame:(CGRect)frame arrowImageName:(NSString *)arrow textColor:(UI

}

- (id)initWithFrame:(CGRect)frame {
return [self initWithFrame:frame arrowImageName:@"blueArrow.png" textColor:TEXT_COLOR];
}

#pragma mark -
#pragma mark Setters
Expand All @@ -112,12 +106,11 @@ - (void)refreshLastUpdatedDate {

NSDate *date = [_delegate egoRefreshTableHeaderDataSourceLastUpdated:self];

[NSDateFormatter setDefaultFormatterBehavior:NSDateFormatterBehaviorDefault];
NSDateFormatter *dateFormatter = [[[NSDateFormatter alloc] init] autorelease];
[dateFormatter setDateStyle:NSDateFormatterShortStyle];
[dateFormatter setTimeStyle:NSDateFormatterShortStyle];

_lastUpdatedLabel.text = [NSString stringWithFormat:@"Last Updated: %@", [dateFormatter stringFromDate:date]];
NSDateFormatter *formatter = [[NSDateFormatter alloc] init];
[formatter setAMSymbol:@"AM"];
[formatter setPMSymbol:@"PM"];
[formatter setDateFormat:@"MM/dd/yyyy hh:mm:a"];
_lastUpdatedLabel.text = [NSString stringWithFormat:@"Last Updated: %@", [formatter stringFromDate:date]];
[[NSUserDefaults standardUserDefaults] setObject:_lastUpdatedLabel.text forKey:@"EGORefreshTableView_LastRefresh"];
[[NSUserDefaults standardUserDefaults] synchronize];

Expand Down Expand Up @@ -256,7 +249,6 @@ - (void)dealloc {
_statusLabel = nil;
_arrowImage = nil;
_lastUpdatedLabel = nil;
[super dealloc];
}


Expand Down
Empty file removed README
Empty file.
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Dependencies
------------

Include "QuartzCore" in your target to successfully compile.