-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathSuperViewController.m
304 lines (232 loc) · 7.55 KB
/
SuperViewController.m
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
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
//
// SuperViewController.m
// Esqueleto DCU
//
// Created by Julio César on 12/6/11.
// Copyright 2011 __MyCompanyName__. All rights reserved.
//
#import "SuperViewController.h"
#import "SP.h"
#import "CO.h"
#import "CM.h"
#import "LC.h"
#import "LA.h"
#import "AM.h"
#import "TM.h"
#import "TI.h"
#import "CL.h"
#import "IN.h"
#import "RE.h"
#import "E1.h"
#import "E2.h"
#import "Reachability.h"
@implementation SuperViewController
- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{
self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
if (self) {
// Custom initialization
}
return self;
}
- (void)dealloc
{
[super dealloc];
}
- (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
/*
// Implement loadView to create a view hierarchy programmatically, without using a nib.
- (void)loadView
{
}
*/
// Implement viewDidLoad to do additional setup after loading the view, typically from a nib.
- (void)viewDidLoad
{
[super viewDidLoad];
// [self reachability];
}
- (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);
}
-(Boolean)reachability{
NSString *filePath = [[NSBundle mainBundle] pathForResource:@"Info" ofType:@"plist"];
NSMutableDictionary* plistDict = [[NSMutableDictionary alloc] initWithContentsOfFile:filePath];
NSString *valuewifi;
valuewifi = [plistDict valueForKey:@"Wifi"];
NSString *valuedatos;
valuedatos = [plistDict valueForKey:@"Datos"];
NSLog(@"Wifi: %@",valuewifi);
NSLog(@"Datos: %@",valuedatos);
Boolean status = true;
Reachability* wifiReach = [[Reachability reachabilityWithHostName: @"http://132.248.204.131:8080/podcast/service/top?tipo=fav"]
retain];
/* Reachability* wifiReach = [[Reachability reachabilityWithHostName: @"www.apple.com"]
retain]; */
NetworkStatus netStatus = [wifiReach currentReachabilityStatus];
if(netStatus == NotReachable)
{
// no connection
@try {
[self e1];
}
@catch (NSException *exception) {
}
@finally {
}
status = false;
NSLog(@"Internet not reachable");
} else if(netStatus == ReachableViaWiFi && valuewifi == NO)
{
[self e2];
// WiFi connection
} else if(netStatus == ReachableViaWWAN && valuedatos == NO)
{
[self e2];
// 3G connection
}
return status;
}
-(Boolean)internetreachability{
Reachability* wifiReach = [[Reachability reachabilityWithHostName: @"www.apple.com"] retain];
NetworkStatus netStatus = [wifiReach currentReachabilityStatus];
if(netStatus == NotReachable)
{
// no connection
@try {
//[self e1];
}
@catch (NSException *exception) {
}
@finally {
}
return NO;
} else if(netStatus == ReachableViaWiFi)
{
// WiFi connection
} else if(netStatus == ReachableViaWWAN)
{
// 3G connection
}
return YES;
}
#pragma mark - IBAction
-(IBAction)sp
{
SP *nextPage = [[SP alloc] initWithNibName:@"SP" bundle:nil];
nextPage.modalTransitionStyle = UIModalTransitionStyleCrossDissolve;
[self.view addSubview:nextPage.view];
[self presentModalViewController:nextPage animated:YES];
}
-(IBAction)co
{
CO *nextPage = [[CO alloc] initWithNibName:@"CO" bundle:nil];
nextPage.modalTransitionStyle = UIModalTransitionStyleCrossDissolve;
[self.view addSubview:nextPage.view];
[self presentModalViewController:nextPage animated:YES];
}
-(IBAction)cm
{
CM *nextPage = [[CM alloc] initWithNibName:@"CM" bundle:nil];
nextPage.modalTransitionStyle = UIModalTransitionStyleCrossDissolve;
[self.view addSubview:nextPage.view];
[self presentModalViewController:nextPage animated:YES];
}
-(IBAction)lc
{
LC *nextPage = [[LC alloc] initWithNibName:@"LC" bundle:nil];
nextPage.modalTransitionStyle = UIModalTransitionStyleCrossDissolve;
[self.view addSubview:nextPage.view];
[self presentModalViewController:nextPage animated:YES];
}
-(IBAction)la
{
LA *nextPage = [[LA alloc] initWithNibName:@"LA" bundle:nil];
nextPage.modalTransitionStyle = UIModalTransitionStyleCrossDissolve;
[self.view addSubview:nextPage.view];
[self presentModalViewController:nextPage animated:YES];
}
-(IBAction)am
{
AM *nextPage = [[AM alloc] initWithNibName:@"AM" bundle:nil];
nextPage.modalTransitionStyle = UIModalTransitionStyleCrossDissolve;
[self.view addSubview:nextPage.view];
[self presentModalViewController:nextPage animated:YES];
}
-(IBAction)tm
{
TM *nextPage = [[TM alloc] initWithNibName:@"TM" bundle:nil];
nextPage.modalTransitionStyle = UIModalTransitionStyleCrossDissolve;
[self.view addSubview:nextPage.view];
[self presentModalViewController:nextPage animated:YES];
}
-(IBAction)ti
{
TI *nextPage = [[TI alloc] initWithNibName:@"TI" bundle:nil];
nextPage.modalTransitionStyle = UIModalTransitionStyleCrossDissolve;
[self.view addSubview:nextPage.view];
[self presentModalViewController:nextPage animated:YES];
}
-(IBAction)cl
{
CL *nextPage = [[CL alloc] initWithNibName:@"CL" bundle:nil];
nextPage.modalTransitionStyle = UIModalTransitionStyleCrossDissolve;
[self.view addSubview:nextPage.view];
[self presentModalViewController:nextPage animated:YES];
}
-(IBAction)in
{
IN *nextPage = [[IN alloc] initWithNibName:@"IN" bundle:nil];
nextPage.modalTransitionStyle = UIModalTransitionStyleCrossDissolve;
[self.view addSubview:nextPage.view];
[self presentModalViewController:nextPage animated:YES];
}
-(IBAction)re
{
RE *nextPage = [[RE alloc] initWithNibName:@"RE" bundle:nil];
nextPage.modalTransitionStyle = UIModalTransitionStyleCrossDissolve;
[self.view addSubview:nextPage.view];
[self presentModalViewController:nextPage animated:YES];
}
-(IBAction)e1
{
E1 *nextPage = [[E1 alloc] initWithNibName:@"E1" bundle:nil label1String:@"La aplicación no puede conectarse a internet para obtener los datos que necesita.Revise su conexión o las configuraciones de la aplicación."];
nextPage.modalTransitionStyle = UIModalTransitionStyleCrossDissolve;
[self.view addSubview:nextPage.view];
[self presentModalViewController:nextPage animated:YES];
}
-(IBAction)e2
{
E2 *nextPage = [[E2 alloc] initWithNibName:@"E2" bundle:nil];
nextPage.modalTransitionStyle = UIModalTransitionStyleCrossDissolve;
[self.view addSubview:nextPage.view];
[self presentModalViewController:nextPage animated:YES];
}
-(IBAction)dissmiss {
[self dismissModalViewControllerAnimated:YES];
}
-(IBAction)exit:(id)sender
{
exit(0);
}
-(IBAction)alertComingSoon:(id)sender
{
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:nil message:@"Proximamente..."
delegate:self cancelButtonTitle:@"OK" otherButtonTitles:nil];
[alert show];
}
@end