-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathJXActivityIndicatorView.m
More file actions
159 lines (124 loc) · 3.7 KB
/
JXActivityIndicatorView.m
File metadata and controls
159 lines (124 loc) · 3.7 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
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
//
// JXActivityIndicatorView.m
// RSSReader
//
// Created by GUYU XUE on 22/12/11.
// Copyright (c) 2011 Nanyang Technological University. All rights reserved.
//
#import "JXActivityIndicatorView.h"
@implementation JXActivityIndicatorView
@synthesize textInfo;
//@synthesize myTextView;
@synthesize myActivityIndicator;
- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{
self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
if (self) {
// Custom initialization
}
return self;
}
- (void)didReceiveMemoryWarning
{
// Releases the view if it doesn't have a superview.
[super didReceiveMemoryWarning];
// Release any cached data, images, etc that aren't in use.
}
#pragma mark - View lifecycle
- (void)viewDidLoad
{
[super viewDidLoad];
NSLog(@"AAAABBBBCCCC");
// Do any additional setup after loading the view from its nib.
/*
if(self.interfaceOrientation==UIInterfaceOrientationLandscapeLeft || self.interfaceOrientation==UIInterfaceOrientationLandscapeRight)
{
//[self configureViewRotated];
}
else
{
//[self configureView];
}
*/
}
- (void)viewDidUnload
{
[super viewDidUnload];
// Release any retained subviews of the main view.
// e.g. self.myOutlet = nil;
}
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
// Return YES for supported orientations
return (interfaceOrientation == UIInterfaceOrientationPortrait
|| interfaceOrientation == UIInterfaceOrientationLandscapeLeft
|| interfaceOrientation == UIInterfaceOrientationLandscapeRight);
}
#pragma mark - configure view
/*
-(void) configureView
{
int height=0;
int MARGIN_BETWEEN=15;
int TOP_MARGIN=100;
//view
CGRect tempFrame=self.view.frame;
tempFrame.size.width=320;
tempFrame.size.height=480;
self.view.frame=tempFrame;
//title
//myTextView.text=textInfo;
CGSize maximumLabelSize = CGSizeMake(296,9999);
CGSize expectedLabelSize = [textInfo sizeWithFont:myTextView.font constrainedToSize:maximumLabelSize lineBreakMode:myTextView.lineBreakMode];
tempFrame = myTextView.frame;
tempFrame.size.height = expectedLabelSize.height;
tempFrame.origin.y=TOP_MARGIN;
myTextView.frame = tempFrame;
height+=TOP_MARGIN+tempFrame.size.height;
//indicator
tempFrame = myActivityIndicator.frame;
tempFrame.origin.y=height+MARGIN_BETWEEN;
myActivityIndicator.frame = tempFrame;
}
-(void)configureViewRotated
{
int height=0;
int MARGIN_BETWEEN=15;
int TOP_MARGIN=50;
//view
CGRect tempFrame;
NSLog(@"rotate");
tempFrame=self.view.frame;
tempFrame.size.width=460;
tempFrame.size.height=320;
self.view.frame=tempFrame;
//title
myTextView.text=textInfo;
CGSize maximumLabelSize = CGSizeMake(296,9999);
CGSize expectedLabelSize = [textInfo sizeWithFont:myTextView.font constrainedToSize:maximumLabelSize lineBreakMode:myTextView.lineBreakMode];
tempFrame = myTextView.frame;
tempFrame.size.height = expectedLabelSize.height;
tempFrame.origin.y=TOP_MARGIN;
myTextView.frame = tempFrame;
height+=TOP_MARGIN+tempFrame.size.height;
//indicator
tempFrame = myActivityIndicator.frame;
tempFrame.origin.y=height+MARGIN_BETWEEN;
myActivityIndicator.frame = tempFrame;
}
*/
#pragma mark - methods
-(void) waitingStart
{
//[self configureView];
[myActivityIndicator startAnimating];
}
-(void) waitingStop
{
[myActivityIndicator stopAnimating];
}
-(BOOL) isAnimating
{
return [myActivityIndicator isAnimating];
}
@end