Free Trial

Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.


  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • DownloadDownload
  • PrintPrint
Share this Page URL
Help

Chapter 28. Web Services > Challenge: Add a WebView

Challenge: Add a WebView

At the moment, you are using NSWorkspace to open the Web page in another application. Perhaps the user would like it if the the web page appeared in a sheet in the existing application (Figure 28.7).

Figure 28.7. Use WebView to Display Details

Image

The challenge, then, is to add a new window with a WebView to your application. Bring the window onto the screen as a sheet.

You will need to add the WebKit framework to your project.

If you have a string representing a URL, you can get a WebView to load that URL by sending it the following message:

- (void)setMainFrameURL:(NSString *)URLString;

That should be all you need. If you want a progress indicator, you will need to make your controller the “frame load delegate” of the WebView:


  

You are currently reading a PREVIEW of this book.

                                                                                        

Get instant access to over
$1 million worth of books and videos.

  

Start a Free Trial