I've heard varying things about whether or not creating a Subclass of UIWebView is allowable. Can someone link me to any documentation that clarifies this one way or another?
There are mixed messages coming from Apple on this.
The docs do say not to subclass as BoltClock noted. However, one of the presentations from WWDC 2011, Rich Text Editing in Safari on iOS, suggests subclassing. It appears to be the only way to add custom UIMenuItems.
From the slides:
// For your UIWebView subclass:
- (void)bold:(id)sender {
[self stringByEvaluatingJavaScript:@”document.execCommand(‘Bold’)];
}
- (BOOL)canPerformAction:(SEL)action withSender:(id)sender {
if (action == @selector(bold:))
return YES;
return [super canPerformAction:action withSender:sender];
}
I need functionality other than Copy and Paste in my app so I'll be subclassing.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With