• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: questions on WebView for Mac apps
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: questions on WebView for Mac apps


  • Subject: Re: questions on WebView for Mac apps
  • From: Jens Alfke <email@hidden>
  • Date: Tue, 29 Sep 2015 20:06:09 -0700

> On Sep 29, 2015, at 7:03 PM, Alex Hall <email@hidden> wrote:
>
> 1. What class do I want to use when making an outlet for my web view UI element?

Don’t use a custom object. There should be a WebView item in the Interface Builder object palette already.

> but "WebView" gives me an error: "use of undeclared type 'WebView’".

WebView is in the WebKit framework. To tell the compiler to look in that framework, you need to add
	@import WebKit
or
	#import <WebKit/WebKit.h>

> 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)

Have you read the WebKit Programming Guide? The “Simple Browsing” section shows exactly how to do that. (It looks like your line is correct.)

> 3. Is there any easy way to tell if a URL ends in a webpage or a file?

There’s not really a clear distinction. WebKit just fetches resources over HTTP, and depending on the resource’s attributes like Content-Type and Content-Disposition it will treat it differently. I don’t think WebView by itself will download anything to disk; IIRC you have to hook up some delegates to do that.

—Jens
_______________________________________________

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


References: 
 >questions on WebView for Mac apps (From: Alex Hall <email@hidden>)

  • Prev by Date: Re: Can't get dynamically sized Collection View cells
  • Next by Date: Re: questions on WebView for Mac apps
  • Previous by thread: questions on WebView for Mac apps
  • Next by thread: Re: questions on WebView for Mac apps
  • Index(es):
    • Date
    • Thread