osx - How to implement x:y named delegate methods? -


For this article, I want to create a WebView WebFrameLoadDelegate method in Delphi:

  

- (zero) webview: (webview *) sender didFinishLoadForFrame: (webfram *) frame

How should this method be announced in Delphi?

This don does not work:

  Public Functionality didFinishLoadForm (webView: WebView; sender: webframe); Cdecl; Process webViewdidFinishLoadForm (webview: webview; sender: webframe); Cdecl;  

Setting the delegate class looks okay using webview.setFrameLoadDelegate (d.GetObjectID);

Where D is the TMyWebViewDelegate (TOCObject) class, with the GetObjectiveClass override, an interface (NSObject) is returning, such as a toolbar representative here

but my method is not called What is the pattern to declare such obj-c methods?

It is best to use the correct names generally the methods and parameters (as responded by Rudy ) But sometimes it is not possible. Two functions may require a single name, but there are similar parameter types so that overload can not be used. In that case you can use the MethodName attribute. So here's another valid solution:

  [MethodName ('webview: didFinishLoadForFrame:')] process webViewdidFinishLoadForm (Sender: WebView; Frame: Webframe); Cdecl;  

Comments