开发者

Add a Contextual Menu to WebView

开发者 https://www.devze.com 2022-12-29 13:26 出处:网络
An easy one, I think: I want to add a contextual menu to a WebView. In IB, I added a NSMenu to the NIB, connected it to the WebView\'s menu outlet, launched and expected to be able to control-click

An easy one, I think:

I want to add a contextual menu to a WebView.

In IB, I added a NSMenu to the NIB, connected it to the WebView's menu outlet, launched and expected to be able to control-click in the WebView and see the pop-up menu. The only item I saw on the contextual menu is "reload". I can do the same steps but开发者_开发问答 connect the Menu to some other view and it works as expected.

Why doesn't the menu work the same when connect to the webview's menu outlet?

Thanks


WebView calls the following method of its WebViewUIDelegate:

webView:contextMenuItemsForElement:defaultMenuItems:

Use setUIDelegate: to set a custom UI delegate.

0

精彩评论

暂无评论...
验证码 换一张
取 消