-
-
Save CreatureSurvive/00e25a0a1b6e8018ceba1cc24549302e to your computer and use it in GitHub Desktop.
SFSafariViewController Objective-C example
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#import <UIKit/UIKit.h> | |
@import SafariServices; | |
@interface AViewController : UIViewController | |
// | |
// ... | |
// | |
@end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#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