Permalink
Browse files

Updated for ARC

  • Loading branch information...
1 parent 8d9c05f commit 91273e48dec6b148cc8fcefe0306f13e5df4fc34 @thuss thuss committed Nov 8, 2012
Showing with 13 additions and 23 deletions.
  1. +8 −8 PullToRefreshView.h
  2. +5 −15 PullToRefreshView.m
View
@@ -41,19 +41,19 @@ typedef enum {
PullToRefreshViewState state;
}
-@property (nonatomic, retain) UIScrollView *scrollView;
-@property (nonatomic, retain) NSTimer *timer;
-@property (nonatomic, assign) id<PullToRefreshViewDelegate> delegate;
+@property (nonatomic, weak) UIScrollView *scrollView;
+@property (nonatomic, strong) NSTimer *timer;
+@property (nonatomic, weak) id<PullToRefreshViewDelegate> delegate;
@property (nonatomic, assign) NSTimeInterval timeout;
-@property (nonatomic, retain) UILabel *lastUpdatedLabel;
-@property (nonatomic, retain) UILabel *statusLabel;
-@property (nonatomic, retain) CALayer *arrowImage;
-@property (nonatomic, retain) UIActivityIndicatorView *activityView;
+@property (nonatomic, strong) UILabel *lastUpdatedLabel;
+@property (nonatomic, strong) UILabel *statusLabel;
+@property (nonatomic, strong) CALayer *arrowImage;
+@property (nonatomic, strong) UIActivityIndicatorView *activityView;
@property (assign, readonly) BOOL isBottom;
@property (nonatomic, copy) NSString *pullToRefreshText;
@property (nonatomic, copy) NSString *releaseToRefreshText;
@property (nonatomic, copy) NSString *loadingText;
-@property (readwrite, nonatomic, retain) NSDateFormatter *dateFormatter;
+@property (readwrite, nonatomic, strong) NSDateFormatter *dateFormatter;
- (void)refreshLastUpdatedDate;
View
@@ -110,7 +110,7 @@ - (id)initWithScrollView:(UIScrollView *)scroll atBottom:(BOOL)atBottom {
self.autoresizingMask = UIViewAutoresizingFlexibleWidth;
self.backgroundColor = [UIColor colorWithRed:226.0/255.0 green:231.0/255.0 blue:237.0/255.0 alpha:1.0];
- self.lastUpdatedLabel = [[[UILabel alloc] initWithFrame:CGRectMake(0.0f, visibleBottom - 30.0f, self.frame.size.width, 20.0f)] autorelease];
+ self.lastUpdatedLabel = [[UILabel alloc] initWithFrame:CGRectMake(0.0f, visibleBottom - 30.0f, self.frame.size.width, 20.0f)];
self.lastUpdatedLabel.autoresizingMask = UIViewAutoresizingFlexibleWidth;
self.lastUpdatedLabel.font = [UIFont systemFontOfSize:12.0f];
self.lastUpdatedLabel.textColor = TEXT_COLOR;
@@ -120,7 +120,7 @@ - (id)initWithScrollView:(UIScrollView *)scroll atBottom:(BOOL)atBottom {
self.lastUpdatedLabel.textAlignment = UITextAlignmentCenter;
[self addSubview:self.lastUpdatedLabel];
- self.statusLabel = [[[UILabel alloc] initWithFrame:CGRectMake(0.0f, visibleBottom - 48.0f, self.frame.size.width, 20.0f)] autorelease];
+ self.statusLabel = [[UILabel alloc] initWithFrame:CGRectMake(0.0f, visibleBottom - 48.0f, self.frame.size.width, 20.0f)];
self.statusLabel.autoresizingMask = UIViewAutoresizingFlexibleWidth;
self.statusLabel.font = [UIFont boldSystemFontOfSize:13.0f];
self.statusLabel.textColor = TEXT_COLOR;
@@ -130,7 +130,7 @@ - (id)initWithScrollView:(UIScrollView *)scroll atBottom:(BOOL)atBottom {
self.statusLabel.textAlignment = UITextAlignmentCenter;
[self addSubview:self.statusLabel];
- self.arrowImage = [[[CALayer alloc] init] autorelease];
+ self.arrowImage = [[CALayer alloc] init];
UIImage *arrow = [UIImage imageNamed:@"arrow"];
self.arrowImage.contents = (id) arrow.CGImage;
self.arrowImage.frame = CGRectMake(25.0f, visibleBottom - kViewHeight + 5.0f, arrow.size.width, arrow.size.height);
@@ -145,7 +145,7 @@ - (id)initWithScrollView:(UIScrollView *)scroll atBottom:(BOOL)atBottom {
[self.layer addSublayer:self.arrowImage];
- self.activityView = [[[UIActivityIndicatorView alloc] initWithActivityIndicatorStyle:UIActivityIndicatorViewStyleGray] autorelease];
+ self.activityView = [[UIActivityIndicatorView alloc] initWithActivityIndicatorStyle:UIActivityIndicatorViewStyleGray];
self.activityView.frame = CGRectMake(30.0f, visibleBottom - 38.0f, 20.0f, 20.0f);
[self addSubview:self.activityView];
@@ -192,8 +192,7 @@ - (NSDateFormatter *)dateFormatter {
- (void)setDateFormatter:(NSDateFormatter *)formatter {
if (dateFormatter != formatter) {
- [dateFormatter release];
- dateFormatter = [formatter retain];
+ dateFormatter = formatter;
[self refreshLastUpdatedDate];
}
}
@@ -375,15 +374,6 @@ -(void)removeFromSuperview {
- (void)dealloc {
[self cleanUp];
- [arrowImage release];
- [activityView release];
- [statusLabel release];
- [lastUpdatedLabel release];
- [pullToRefreshText release];
- [releaseToRefreshText release];
- [loadingText release];
- [dateFormatter release];
- [super dealloc];
}
@end

0 comments on commit 91273e4

Please sign in to comment.