Given that there is no such API, you can still customize the non-standard-api-like-way worksheet without using a private api. The easiest way is probably to watch the views of this web view, and when one appears (for example, a pop-up window), it checks its class and, if it is such a pop-up window, it can be configured. This is how I try it.
However: this is hacky and could easily break in the next update.
Add observation:
[myWebView addObserver:self forKeyPath:@"subviews" options:0 context:@"popup"];
Then observe:
- (void)observeValueForKeyPath:(NSString *)keyPath
ofObject:(id)object
change:(NSDictionary *)change
context:(void *)context
{
if (context == @"popup") {
for (UIView *view in [object subviews]) {
if ([view isKindOfClass: [UIAlertView class]])
[self customizeAlert: (UIAlertView*)view];
}
}
[super observeValueForKeyPath:keyPath
ofObject:object
change:change
context:context];
}
Then do your setup in this way:
- (void)customizeAlert:(UIAlertView*)alert { ... }
source
share