questions on WebView for Mac apps
questions on WebView for Mac apps
- Subject: questions on WebView for Mac apps
- From: Alex Hall <email@hidden>
- Date: Tue, 29 Sep 2015 22:03:54 -0400
Hello all,
My project is coming along. I'm now to the point where I want to load data from a URL into a WebView, but there's surprisingly little (read: next to nothing) about doing this in an app on the Mac. That or I'm googling the wrong terms. Anyway, what I'm running into are the following:
1. What class do I want to use when making an outlet for my web view UI element? I found the class reference:
https://developer.apple.com/library/mac/documentation/Cocoa/Reference/WebKit/Classes/WebView_Class/index.html#//apple_ref/occ/instm/WebView
but "WebView" gives me an error: "use of undeclared type 'WebView'".
2. The class reference makes this looks very complex, and rightly so. Since I don't have an outlet yet I can't test anything, but is this what I'd do to take a known URL and display the page it points to:
myWebView.mainFrame.loadRequest(someURLRequestObject)
or is there more to it from the outset? I'll eventually use delegates to handle progress, errors, and so on, but I want the basics working first.
3. Is there any easy way to tell if a URL ends in a webpage or a file? For example, I want to auto-display content from a selected URL, but I don't necessarily want to auto-download (potentially huge) files. If I use a download delegate, can I handle this behavior there instead of worrying about trying to figure things out at the request level?
4. Back to WebView, or whatever it winds up being called. This is a bit off the topic, but are there any auto layout gotchas I should know? I've read a lot about how terrible scroll views with auto layout can be, and I just want to know if a similar thing will happen with this view too.
I think that's it. Thanks, as always, for your help!
--
Have a great day,
Alex Hall
email@hidden
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden