Last active
September 11, 2015 10:12
-
-
Save shazron/e38c86a08eeac48848da to your computer and use it in GitHub Desktop.
This file contains hidden or 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
// In MainViewController.m | |
- (id)init | |
{ | |
self = [super init]; | |
if (self) { | |
// listens for CDVPageDidLoadNotification | |
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(applicationPageDidLoad:) name:CDVPageDidLoadNotification object:nil]; | |
} | |
return self; | |
} | |
// handler for CDVPageDidLoadNotification | |
- (void)applicationPageDidLoad:(NSNotification*)notification | |
{ | |
UIView* webView = [notification object]; | |
// Black base color for background matches the native apps | |
webView.backgroundColor = [UIColor blackColor]; | |
// Disable user selection | |
NSString* s1 = @"document.documentElement.style.webkitUserSelect='none';"; | |
[self.webViewEngine evaluateJavaScript:s1 completionHandler:nil]; | |
// Disable callout | |
NSString* s2 = @"document.documentElement.style.webkitTouchCallout='none';"]; | |
[self.webViewEngine evaluateJavaScript:s2 completionHandler:nil]; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment