Skip to content

Instantly share code, notes, and snippets.

@alexruperez
Last active April 4, 2016 10:37
Show Gist options
  • Save alexruperez/ab5e175d40413faea0a8 to your computer and use it in GitHub Desktop.
Save alexruperez/ab5e175d40413faea0a8 to your computer and use it in GitHub Desktop.

Revisions

  1. alexruperez revised this gist Feb 8, 2016. 2 changed files with 2 additions and 2 deletions.
    2 changes: 1 addition & 1 deletion ARSafariViewController.h
    Original file line number Diff line number Diff line change
    @@ -1,7 +1,7 @@
    //
    // ARSafariViewController.h
    //
    // Copyright © 2016 alexruperez. All rights reserved.
    // Copyright © 2016 alexruperez. The MIT License (MIT)
    //

    @import SafariServices;
    2 changes: 1 addition & 1 deletion ARSafariViewController.m
    Original file line number Diff line number Diff line change
    @@ -1,7 +1,7 @@
    //
    // ARSafariViewController.m
    //
    // Copyright © 2016 alexruperez. All rights reserved.
    // Copyright © 2016 alexruperez. The MIT License (MIT)
    //

    #import "ARSafariViewController.h"
  2. alexruperez created this gist Feb 8, 2016.
    11 changes: 11 additions & 0 deletions ARSafariViewController.h
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,11 @@
    //
    // ARSafariViewController.h
    //
    // Copyright © 2016 alexruperez. All rights reserved.
    //

    @import SafariServices;

    @interface ARSafariViewController : SFSafariViewController

    @end
    54 changes: 54 additions & 0 deletions ARSafariViewController.m
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,54 @@
    //
    // ARSafariViewController.m
    //
    // Copyright © 2016 alexruperez. All rights reserved.
    //

    #import "ARSafariViewController.h"

    @interface ARSafariViewController ()

    @property (nonatomic, assign) BOOL isSwipingBack;

    @end

    @implementation ARSafariViewController

    - (UIStatusBarStyle)preferredStatusBarStyle
    {
    if (self.isSwipingBack)
    {
    return [self.presentingViewController preferredStatusBarStyle];
    }

    return [super preferredStatusBarStyle];
    }

    - (BOOL)prefersStatusBarHidden
    {
    if (self.isSwipingBack)
    {
    return [self.presentingViewController prefersStatusBarHidden];
    }

    return [super prefersStatusBarHidden];
    }

    - (void)viewWillDisappear:(BOOL)animated
    {
    self.isSwipingBack = YES;

    [self.transitionCoordinator notifyWhenInteractionEndsUsingBlock:^(id<UIViewControllerTransitionCoordinatorContext> context) {
    self.isSwipingBack = NO;
    }];

    [super viewWillDisappear:animated];
    }

    - (void)setIsSwipingBack:(BOOL)isSwipingBack
    {
    _isSwipingBack = isSwipingBack;
    [self setNeedsStatusBarAppearanceUpdate];
    }

    @end