connecting UIWebView to actions

Discussion in 'iOS Programming' started by begdev, Mar 14, 2009.

  1. begdev macrumors newbie

    Joined:
    Mar 14, 2009
    #1
    alright so here's a screenshot:

    [​IMG]

    I started out with a tab based application, then i added two view controllers to the tab bar, and then I loaded two seperate xibs in them.

    The screenshot i attached has first a view, then an image view (with the background), then the buttons, the nav bar at the top, and then finally the UIWebView. My question is that, I have this for my action:
    Code:
    - (IBAction)loadBook {
       WEBVIEW.scalesPageToFit = YES;
    	[mainView loadRequest:[NSURLRequest requestWithURL:[NSURL URLWithString:@"http://www.google.com/books?hl=en"]]];
    }
    And then i connected the action to the button that i want to bring the UIWebView to. What I'm having trouble with is, that i was following this tutorial:http://iphonedevcentral.org/tutorials.php?page=ViewTutorial&id=34&uid=59068116 but i cant connect the delegate outlet to the UIWebView.

    Anyway, back to my point, so do i select the UIWebView, then go to the info part and make its class: XXX, then make the actions in there, and then connect the actions to the appropriate buttons, and then in the code do i just change WEBVIEW with XXX??

    For the view i have in the screenshot, i wrote class files, and now have MainView .h and .m, so that's where the actions go, correct?

    Do I need to do any thing with the AppDelegate? Because the tut kept referring to it.

    Are any @class, @implementation, #include's needed?
     
  2. eddietr macrumors 6502a

    Joined:
    Oct 29, 2006
    Location:
    Virginia
    #2
    Judging by the questions you're asking, this may be a good time to take a step back and learn some fundamentals of Mac or iPhone programming.

    Maybe going through a good book on Mac development like Hillegass or Kochan would be a good investment of time. And then that understanding will be very transferable to iPhone development. A few others on this board seem to be going through the same learning process.

    I know that may seem like a big investment of time, but then tasks like this will be very easy because you'll really understand how all the pieces fit together. As opposed to just sort of guessing your way through it.

    Good luck. And if you have specific questions or run into specific errors along the way, I'm sure many people here can answer those.
     
  3. begdev thread starter macrumors newbie

    Joined:
    Mar 14, 2009
    #3
    i know, i have always programmed on windows, but i need the app done by monday morning, and the thing is, i can't do it, after i get this done though, i am going to learn in a more in-depth way. But right now I am crammed for time, I have been trying for hours. So any suggestions to the problems I'm having?
     
  4. eddietr macrumors 6502a

    Joined:
    Oct 29, 2006
    Location:
    Virginia
    #4
    Is this for a class?

    If it's for work, you might want to have a talk with your boss (or client?). There is a learning curve to be expected in picking up a whole new platform. It sounds like maybe they didn't realize that.

    If I'm understanding your problem correctly, you want each of the buttons on the left to cause the web view on the right to load a particular URL. If that's the case, one reasonable way to do that is to create a view controller for this view (you may have done that already) which has an action (or actions) to which you would connect each button.

    The view controller would have an outlet to the web view so it can send messages to that view to load URLs as needed.

    Assuming I'm understanding the question correctly...
     

Share This Page