Linking to UIWebView in a second view via button

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

  1. begdev macrumors newbie

    Mar 14, 2009
    Ok so I have a tab based application like this:

    - Tab View Controller
    - Two seperate .xib files FirstView and SecondView

    The MainWindow.xib has a Tab Bar Controller with a blank view, and then a tab bar at the bottom with TWO Viewcontrollers

    The first View has: Top Nav Bar with two Bar Buttons, a UIWebView
    The second View has: Nav Bar w/ title and 6 buttons

    Everything loads fine, and the tab buttons work.
    But what I want to do is when the user taps one of the buttons on the second View, it goes back to the first view automatically, and then load a specified URL based on which button the user picked.

    I pretty much need the whole process laid out for me, because i just don't understand.

    I believe i need IBOutlets and then connect those with the buttons, but i don't know which file i should put the outlets in,
    then i don't know how to make the actions to go make to the first view automatically, and then load a specified URL.

    Very simple idea, but this is my first app that was above simply displaying things or following a strict tutorial. After I get this out of my way, i am going to begin to learn myself. I just REALLY need help on this, my deadline is monday, and I also have to figure out how to get it on my ipod.

    If you need screenshots just ask.
    EDIT: You know, people say that if you know C++ it should be easy to learn objective-c and how to make apps, well, it isn't i think I have problems connecting the interface with the code, I have only made command line applications recently in C++
  2. dejo Moderator


    Staff Member

    Sep 2, 2004
    The Centennial State
    Asking someone else to give you the solution, especially with a rush, is not going usually work around here. Ask for hints. Ask for suggestions. Ask for direction. Those work better.

    Setup the IBOutlets in the viewcontroller of the second view. Same with the IBAction. In the action method, set some kinda of flag, transition to the first view, and then do what you need based on that flag when the view apppears. Hope that gets you started.
  3. begdev thread starter macrumors newbie

    Mar 14, 2009
    trust me i know, i am a member of forum and never beg or anything, although i am truly in a desperate situation and really need help, but like i said after this, i am going to be learning in a more long-term kinda of thing. right now i am just really frustrated and lost. Ive been at this for probably 5 hours.
  4. begdev thread starter macrumors newbie

    Mar 14, 2009
    ok so i have the class files:
    FirstViewController .h & .m
    SecondViewController .h & .m :EDIT I think i deleted the secondview files, but i just recreated viewcontroller subclass files.
    AppDelegate .h & .m

    I tried putting IBOutlets in FirstViewController.h, but then when i tried to connect them in secondview, they didn't show up. That's what i mean, I just don't know where to put stuff. That's what I meant by laid out.


    EDIT 2: Ok so in the inspector i made the 6 outlets and connected them, now i need to make the actions and connect them? Then I need to write class files and then in the .m i need to do the transition and URL thing

    Thats what i really need help in. i know how to go to a url, but only on awakefromnib.

    ok so i have the viewcontrollers, and the first one has the web view, but the second one is the one with the buttons and actions...

    so can you give me a little of an idea of how i would have the webview in the first viewcontroller go to the url, when the action is in the second one.
  5. CocoaPuffs macrumors 68010

    Aug 23, 2008
    Wow, whoever that helps you must love to be abused...good luck getting help.

Share This Page