-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathPullToRefreshHeaderView.m
More file actions
79 lines (55 loc) · 2.05 KB
/
PullToRefreshHeaderView.m
File metadata and controls
79 lines (55 loc) · 2.05 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
//
// PullToRefreshHeaderView.m
// MoreSquare
//
// Created by Chris Laan on 4/4/11.
// Copyright 2011 Laan Labs. All rights reserved.
//
#import "PullToRefreshHeaderView.h"
@implementation PullToRefreshHeaderView
@synthesize refreshLabel, refreshArrow, refreshSpinner;
- (id)initWithFrame:(CGRect)frame {
self = [super initWithFrame:frame];
if (self) {
// Initialization code.
[self setupUi];
}
return self;
}
-(void) setupUi {
/*
textPull = [[NSString alloc] initWithString:@"Pull down to refresh..."];
textRelease = [[NSString alloc] initWithString:@"Release to refresh..."];
textLoading = [[NSString alloc] initWithString:@"Loading..."];
*/
self.backgroundColor = [UIColor clearColor];
int hgt = self.frame.size.height;
refreshLabel = [[UILabel alloc] initWithFrame:CGRectMake(0, 0, 320, hgt)];
refreshLabel.backgroundColor = [UIColor clearColor];
refreshLabel.font = [UIFont boldSystemFontOfSize:18.0];
refreshLabel.textColor = [UIColor colorWithWhite:1.0 alpha:1.0];
refreshLabel.shadowColor = [UIColor colorWithWhite:0.0 alpha:0.8];
refreshLabel.shadowOffset = CGSizeMake(0, -1);
refreshLabel.textAlignment = UITextAlignmentCenter;
refreshArrow = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"pull-to-refresh-arrow.png"]];
refreshArrow.frame = CGRectMake((hgt - 32) / 2,
(hgt - 44) / 2,
32, 44);
refreshSpinner = [[UIActivityIndicatorView alloc] initWithActivityIndicatorStyle:UIActivityIndicatorViewStyleWhite];
refreshSpinner.frame = CGRectMake((hgt - 20) / 2, (hgt - 20) / 2, 20, 20);
refreshSpinner.hidesWhenStopped = YES;
[self addSubview:refreshLabel];
[self addSubview:refreshArrow];
[self addSubview:refreshSpinner];
}
/*
// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
- (void)drawRect:(CGRect)rect {
// Drawing code.
}
*/
- (void)dealloc {
[super dealloc];
}
@end