UIWebView segmentAction: help

Discussion in 'iOS Programming' started by bobbypotluck, Jun 18, 2010.

  1. bobbypotluck macrumors member

    Joined:
    Feb 18, 2009
    #1
    I'm trying add a segmented controller in a navigation bar in my app which is imbedded in a tab. I'm able to add the navigation controller and segmented buttons to the tab in IB. I read that i need to do something with segmentAction: I'd like the segmented buttons to just change the URL of the webview. To load the URL in the view i'm using this code in the views .m

    -(void)awakeFromNib {
    [HomePage loadRequest:[NSURLRequest requestWithURL:[NSURL URLWithString:mad:"http://m.singletracks.com/map2.php"] ]];

    Can someone get my started with what my code should look like to change the URL when different segment buttons are pressed?
     
  2. dejo Moderator

    dejo

    Staff Member

    Joined:
    Sep 2, 2004
    Location:
    The Centennial State
    #2
    So, you already have your UISegmentedControl triggering the segmentAction: method, is that correct? If so, then inside that method, based on the selected segment index, you'll want to do pretty much what you are doing inside your awakeFromNib.
     
  3. bobbypotluck thread starter macrumors member

    Joined:
    Feb 18, 2009
    #3
    i do not have it triggering that method yet no. All i know is that i read have to do something with the segmentAction: method. All i've done is added the segmented buttons in interface builder, i have not done any code with them at all.
     
  4. dejo Moderator

    dejo

    Staff Member

    Joined:
    Sep 2, 2004
    Location:
    The Centennial State
    #4
    Where are you reading this?
     
  5. bobbypotluck thread starter macrumors member

    Joined:
    Feb 18, 2009
    #5

Share This Page