• 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: Call getElementById in Cocoa
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Call getElementById in Cocoa


  • Subject: Re: Call getElementById in Cocoa
  • From: Pierce Freeman <email@hidden>
  • Date: Mon, 24 Nov 2008 19:16:10 -0800
  • Thread-topic: Call getElementById in Cocoa

Okay Adam, I think I am beginning to understand.  However, I just get two
problems trying to run that code:

1. error: 'request' undeclared (first use in this function)
2. warning: 'webView' may not respond to '+isLoading'

Thanks for your help.


Sincerely,

Pierce Freeman

--
Pierce Freeman
email@hidden





On 11/24/08 7:02 PM, "Adam R. Maxwell" <email@hidden> wrote:

>
> On Nov 24, 2008, at 6:32 PM, Pierce Freeman wrote:
>
>> Sorry for my newbie-ness, but I still don't really get what you are
>> talking
>> about.  Are you saying that I should do this:
>>
>> [WebView setFrameLoadDelegate:didFinishLoadForFrame];
>>
>> - (void)didFinishLoadForFrame
>> {
>>    // Do stuff
>> }
>
> No.  Here you're sending setFrameLoadDelegate: to the WebView class
> instead of an instance, and passing part of the method name as an
> argument.  It likely won't compile, and certainly won't work.
> Additionally, you're missing part of the delegate method signature.
>
> You'd typically have something like this:
>
> - (void)loadURL
> {
>          NSURLRequest *request = [NSURLRequest requestWithURL:_httpURL
> cachePolicy:NSURLRequestReturnCacheDataElseLoad timeoutInterval:60.0];
>
> // self is an object implementing any delegate methods you want to
> receive
>          [_webView setFrameLoadDelegate:self];
>          [[_webView mainFrame] loadRequest:request];
> }
>
> - (void)webView:(WebView *)sender didFailLoadWithError:(NSError *)
> error forFrame:(WebFrame *)frame;
> {
>      // do something with error
> }
>
> - (void)webView:(WebView *)sender didFinishLoadForFrame:(WebFrame *)
> frame
> {
>      // wait until all frames are loaded
>      if (NO == [_webView isLoading])
>          // do something with frame/view
> }
>
> where the delegate messages are delivered after each frame loads or
> fails.  This is the basic delegate pattern in Cocoa, which should be
> explained pretty thoroughly in the documentation.
>
> See
> http://developer.apple.com/documentation/Cocoa/Conceptual/DisplayWebContent/Ta
> sks/LocationChanges.html
>   and
> http://developer.apple.com/documentation/Cocoa/Conceptual/CocoaFundamentals/Co
> mmunicatingWithObjects/chapter_6_section_4.html.


_______________________________________________

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: 
 >Re: Call getElementById in Cocoa (From: "Adam R. Maxwell" <email@hidden>)

  • Prev by Date: Re: Multiple views in a nib file?
  • Next by Date: Re: Need some advice on multithreading
  • Previous by thread: Re: Call getElementById in Cocoa
  • Next by thread: Re: Call getElementById in Cocoa
  • Index(es):
    • Date
    • Thread