Setting up .xib, views, controllers, etc. for UIWebView
I'm try开发者_StackOverflowing to integrate a UIWebView in my app following a tutorial. I believe I've written up the code correctly, but I'm having a little problem with the instructions from the tutorial:
We start by adding a new view to the project. Drag and drop an UIWebView control on the view. As always, create an controller to handle the view, I have named the view and the view controller “WebView” and “WebViewController” respectively. We create a new object of type UIWebView and also declare an associated property. We will use this object to connect “WebView” view placed on the view.
My MainWindow.xib looks like this:
And I have a ViewController called iPhoneTestAppViewController that looks like this:
My question is this: Step by step, what do I need to do in Interface Builder to set up a UIWebView?. Like I said, I believe my code is good (pretty much exactly the same as in the tutorial). I'm just lacking in the Interface Builder skills.
Well, the simple answer is, to quote the tutorial, "Drag and drop an UIWebView control on the view. " In other words, add a peer to LevelMeter etc, and then size it to fit appropriately on the screen. Then just control-drag from your webView object you just added to the File Owner object (which I assume you've previously assigned the type of "iPhoneTestAppViewController"). This will add a webview to your view, which should operate according to the tutorial, but...
I confess that I'm concerned that you expect all those Level-meter, buttons, and textFields to be a part of your webView, which is not the way things work. It will be on the same screen as those things, but operating essentially independently. Sorry if I'm not understanding your goal for the webview.
精彩评论