Skip to content

Instantly share code, notes, and snippets.

@shazron
Last active September 11, 2015 10:12
Show Gist options
  • Save shazron/e38c86a08eeac48848da to your computer and use it in GitHub Desktop.
Save shazron/e38c86a08eeac48848da to your computer and use it in GitHub Desktop.
// 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