Bad*_*ate 4 iphone cocoa-touch uiwebview subclassing
我听说过是否允许创建UIWebView的子类.有人可以将我链接到任何澄清这种或那种方式的文档吗?
Jus*_*ilo 10
Apple对此发出了各种各样的消息.
文档确实说不要像BoltClock所指出的那样继承子类.然而,WWDC 2011的一个演示文稿,iOS上的Safari中的富文本编辑,建议了子类化.它似乎是添加自定义UIMenuItems的唯一方法.
从幻灯片:
// 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];
}
Run Code Online (Sandbox Code Playgroud)
我需要在我的应用程序中复制和粘贴以外的功能,所以我将是子类.
| 归档时间: |
|
| 查看次数: |
3198 次 |
| 最近记录: |