开发者

NSView vs. Webview

Is there disadvantages to using WebKit WebViews compared to using NSViews?

I'm using a webview to create a UI for an applicat开发者_StackOverflow社区ion. The application itself does not have much interactivity. I have seen it mentioned, on this website & others, that using a WebView can be convient means of prototyping.

However, with our team this seems like an ideal way to produce the production ready UIs, especially with WebKit. Are we missing something?

Thanks, Ross


Okay, so you seem to be asking if using an HTML interface (presented via a WebView) for your application has any disadvantages.

The answer to this is "no", at least "not necessarily". This is analogous to building an iPhone specific web application, and there are some excellent examples of those. The caveat would be that a lot of those sites end up recreating the look and feel of a native iPhone app, for consistency and to make the users feel "at home".

Given that you're developing a native app anyway, it seems a shame to throw away, or recreate, the responsiveness and appearance of the native chrome. Of course, for certain types of applications (games are an obvious example) a user has no expectations about the application's UI, so you're free to knock yourself out.

The other factor to consider is the amount of interactivity (although I notice that you say there isn't much in your case). The native controls will make coding a lot simpler than having to capture all user input through the "filter" of a WebView, even though using one might make the initial layout of the screens easier.

I hope that's the sort of answer you were looking for (although it's mostly non technical).


As you might have known if you spend some time in the documentation, you'd have seem that WebView is a subclass of NSView.

The documentation says about WebView:

WebView is the core view class in the WebKit framework that manages interactions between the WebFrame and WebFrameView classes. To embed web content in your application, you just create a WebView object, attach it to a window, and send a loadRequest: message to its main frame.

And about NSView:

NSView is a class that defines the basic drawing, event-handling, and printing architecture of an application. You typically don’t interact with the NSView API directly; rather, your custom view classes inherit from NSView and override many of its methods, which are invoked automatically by the Application Kit. If you’re not creating a custom view class, there are few methods you need to use.

So here's the answer to your question:

Is there disadvantages to using WebKit WebViews compared to using NSViews?

Yes. You can't display any web content with NSView. That's what you need WebView for. I suggest reading some more documentation though.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜