VLCAboutViewController.m 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. //
  2. // VLCAboutViewController.m
  3. // AspenProject
  4. //
  5. // Created by Felix Paul Kühne on 07.04.13.
  6. // Copyright (c) 2013 VideoLAN. All rights reserved.
  7. //
  8. #import "VLCAboutViewController.h"
  9. @interface VLCAboutViewController () {
  10. UIBarButtonItem *_dismissButton;
  11. }
  12. @end
  13. @implementation VLCAboutViewController
  14. - (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
  15. {
  16. self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
  17. return self;
  18. }
  19. - (void)viewDidLoad
  20. {
  21. [super viewDidLoad];
  22. [self.webView loadHTMLString:[NSString stringWithContentsOfFile:[[NSBundle mainBundle] pathForResource:@"About Contents" ofType:@"html"] encoding:NSUTF8StringEncoding error:nil] baseURL:nil];
  23. self.webView.delegate = self;
  24. self.aspenVersion.text = [[NSString stringWithFormat:NSLocalizedString(@"VERSION_FORMAT",@""), [[NSBundle mainBundle] objectForInfoDictionaryKey:@"CFBundleVersion"]] stringByAppendingFormat:@" %@", kVLCVersionCodename];
  25. self.vlckitVersion.text = [NSString stringWithFormat:NSLocalizedString(@"BASED_ON_FORMAT",@""),[[VLCLibrary sharedLibrary] version]];
  26. _dismissButton = [[UIBarButtonItem alloc] initWithTitle:NSLocalizedString(@"BUTTON_DONE", @"")
  27. style:UIBarButtonItemStyleBordered
  28. target:self action:@selector(dismiss)];
  29. [_dismissButton setBackgroundImage:[UIImage imageNamed:@"doneButton"] forState:UIControlStateNormal barMetrics:UIBarMetricsDefault];
  30. [_dismissButton setBackgroundImage:[UIImage imageNamed:@"doneButtonHighlight"] forState:UIControlStateHighlighted barMetrics:UIBarMetricsDefault];
  31. self.navigationItem.rightBarButtonItem = _dismissButton;
  32. }
  33. - (BOOL)webView:(UIWebView *)webView shouldStartLoadWithRequest:(NSURLRequest *)request navigationType:(UIWebViewNavigationType)navigationType
  34. {
  35. NSURL *requestURL = request.URL;
  36. if (![requestURL.scheme isEqualToString:@""])
  37. return ![[UIApplication sharedApplication] openURL:requestURL];
  38. else
  39. return YES;
  40. }
  41. - (void)dismiss
  42. {
  43. [self dismissModalViewControllerAnimated:YES];
  44. }
  45. @end