HelpViewController.m 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687
  1. //
  2. // HelpViewController.m
  3. // TumblrDownloader
  4. //
  5. // Created by HonorLee on 16/1/17.
  6. // Copyright © 2016年 HonorLee. All rights reserved.
  7. //
  8. #import "HelpViewController.h"
  9. #import "Helper.h"
  10. @interface HelpViewController ()
  11. @end
  12. @implementation HelpViewController
  13. MBProgressHUD *HUD;
  14. - (void)viewDidLoad {
  15. [super viewDidLoad];
  16. // Do any additional setup after loading the view.
  17. _JumpToTumblr.layer.borderColor = [[UIColor whiteColor]CGColor];
  18. _JumpToTumblr.layer.borderWidth = 1;
  19. _JumpToTumblr.layer.cornerRadius = 5.0f;
  20. [_JumpToTumblr setTitle:NSLocalizedString(@"OpenTumblrBtnText", nil) forState:UIControlStateNormal];
  21. // _JumpToTumblr.titleLabel.text = NSLocalizedString(@"OpenTumblrBtnText", nil);
  22. _HelpTextView.text = NSLocalizedString(@"HelpText", nil);
  23. [_HelpTextView setTextColor:[UIColor whiteColor]];
  24. [_HelpTextView setFont:[UIFont fontWithName:@"Helvetica Neue" size:16.0]];
  25. HUD = [[MBProgressHUD alloc] initWithView:self.view];
  26. HUD.mode = MBProgressHUDModeText;
  27. HUD.removeFromSuperViewOnHide = NO;
  28. HUD.yOffset = self.view.frame.size.height/2-200;
  29. [self.view addSubview:HUD];
  30. }
  31. - (void)didReceiveMemoryWarning {
  32. [super didReceiveMemoryWarning];
  33. // Dispose of any resources that can be recreated.
  34. }
  35. -(void)viewDidDisappear:(BOOL)animated{
  36. [Helper changeStatusBarBackground:[UIColor whiteColor]];
  37. [self.tabBarController.tabBar setBarTintColor:[UIColor whiteColor]];
  38. }
  39. -(void)viewDidAppear:(BOOL)animated{
  40. [Helper changeStatusBarBackground:[UIColor colorWithRed:0 green:191/255.0 blue:1 alpha:1]];
  41. [self.tabBarController.tabBar setBarTintColor:[UIColor colorWithRed:0 green:191/255.0 blue:1 alpha:1]];
  42. }
  43. /*
  44. #pragma mark - Navigation
  45. // In a storyboard-based application, you will often want to do a little preparation before navigation
  46. - (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
  47. // Get the new view controller using [segue destinationViewController].
  48. // Pass the selected object to the new view controller.
  49. }
  50. */
  51. - (IBAction)ButtonOnPress:(id)sender {
  52. _JumpToTumblr.alpha = 0.5f;
  53. }
  54. - (IBAction)ButtonOnOff:(id)sender {
  55. _JumpToTumblr.alpha = 1.0f;
  56. if ([[UIApplication sharedApplication]canOpenURL:[NSURL URLWithString:@"tumblr://"]]){
  57. HUD.labelText = NSLocalizedString(@"OpenTumblrSuccess", nil);
  58. [HUD show:YES];
  59. [[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"tumblr://"]];
  60. }else{
  61. HUD.labelText = NSLocalizedString(@"OpenTumblrError", nil);
  62. [HUD show:YES];
  63. }
  64. dispatch_time_t popTime = dispatch_time(DISPATCH_TIME_NOW, 2.0*NSEC_PER_SEC);
  65. dispatch_after(popTime, dispatch_get_main_queue(), ^{
  66. [HUD hide:YES];
  67. });
  68. }
  69. - (IBAction)ButtonOnCancel:(id)sender {
  70. _JumpToTumblr.alpha = 1.0f;
  71. }
  72. @end