// // SupportViewController.m // orbit // // Created by Jonathon Horsman on 11/07/2013. // Copyright (c) 2013 Puzzlebox Productions, LLC. All rights reserved. // #import "SupportViewController.h" @implementation SupportViewController @synthesize webView, retryButton, status; - (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil { self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil]; if (self) { // Custom initialization } return self; } - (void)viewDidLoad { [super viewDidLoad]; [self loadSupportSite]; } #define BASEURL [NSURL fileURLWithPath:[[NSBundle mainBundle] bundlePath]] - (void) loadSupportSite { // [webView loadRequest:[NSURLRequest requestWithURL:[NSURL URLWithString: @"http://puzzlebox.info/forums/forumdisplay.php?fid=4"]]]; // [webView loadRequest:[NSURLRequest requestWithURL:[NSURL URLWithString: @"http://orbit.puzzlebox.info/contact"]]]; NSString *urlAddress = [[NSBundle mainBundle] pathForResource:@"support" ofType:@"html"]; NSURL *url = [NSURL fileURLWithPath:urlAddress]; NSURLRequest *requestObj = [NSURLRequest requestWithURL:url]; [webView loadRequest:requestObj]; } #pragma mark UIWebViewDelegate methods - (void)webViewDidFinishLoad:(UIWebView *)webView { retryButton.hidden = YES; status.hidden = YES; } - (void)webView:(UIWebView *)webView didFailLoadWithError:(NSError *)error { UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Not Connected" message:@"Unable to view support since you have no internet connection" delegate:self cancelButtonTitle:@"OK" otherButtonTitles:nil]; [alert show]; retryButton.hidden = NO; status.hidden = NO; status.text = @"Unable to load support site"; } #pragma mark button press methods - (IBAction) retryButtonPressed:(id) sender { retryButton.hidden = YES; status.text = @"Loading support website..."; [self loadSupportSite]; } @end