Skip to content

Instantly share code, notes, and snippets.

@CreatureSurvive
Forked from andrassomogyi/AViewController.h
Created April 23, 2017 04:10
Show Gist options
  • Save CreatureSurvive/00e25a0a1b6e8018ceba1cc24549302e to your computer and use it in GitHub Desktop.
Save CreatureSurvive/00e25a0a1b6e8018ceba1cc24549302e to your computer and use it in GitHub Desktop.
SFSafariViewController Objective-C example
#import <UIKit/UIKit.h>
@import SafariServices;
@interface AViewController : UIViewController
//
// ...
//
@end
#import "AViewController.h"
@interface AViewController () <SFSafariViewControllerDelegate>
@end
@implementation AViewController
//
// ...
//
- (void)displaySafari {
SFSafariViewController *safariVC = [[SFSafariViewController alloc]initWithURL:[NSURL URLWithString:@"http://developer.apple.com"] entersReaderIfAvailable:NO];
safariVC.delegate = self;
[self presentViewController:safariVC animated:NO completion:nil];
}
#pragma mark - SFSafariViewController delegate methods
-(void)safariViewController:(SFSafariViewController *)controller didCompleteInitialLoad:(BOOL)didLoadSuccessfully {
// Load finished
}
-(void)safariViewControllerDidFinish:(SFSafariViewController *)controller {
// Done button pressed
}
//
// ...
//
@end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment