- (void)viewDidLoad {
[super viewDidLoad];
Reachability *networkReachability = [Reachability reachabilityForInternetConnection];
NetworkStatus networkStatus = [networkReachability currentReachabilityStatus];
if (networkStatus == NotReachable) {
// NSLog(@"There IS NO internet connection");
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Opps!!"
message:@"you may need to check your network Conenction.."
delegate:self
cancelButtonTitle:@"Settings"
otherButtonTitles:@"Cancel",nil];
[alert show];
} else {
loadingIndicator = [[UIActivityIndicatorView alloc] initWithFrame:CGRectMake(100, 100, 50,50)];
[loadingIndicator setActivityIndicatorViewStyle:UIActivityIndicatorViewStyleGray];
[loadingIndicator setHidesWhenStopped:YES];
[self registerCells];
[self loadData];
}
// Do any additional setup after loading the view.
}
- (void)alertView:(UIAlertView *)alertView didDismissWithButtonIndex:(NSInteger)buttonIndex {
// the user clicked OK
if (buttonIndex == 0) {
NSURL*url=[NSURL URLWithString:@"prefs:root=WIFI"];
[[UIApplication sharedApplication] openURL:url];
[self.navigationController popViewControllerAnimated:YES];
}
if (buttonIndex == 1) {
[self.navigationController popViewControllerAnimated:YES];
}
}