Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7502405
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T20:51:32+00:00 2026-05-29T20:51:32+00:00

I am using a UITableView that points to a UITabBarController to display a series

  • 0

I am using a UITableView that points to a UITabBarController to display a series of UIWebViews within these tabs.

I would like define a string to be used to construct a URL for each tab based on the item selected. The issue I am facing is how to pass the URL to the StateTrendViewController controller.

StateTableViewController.h

#import <UIKit/UIKit.h>

@interface StateTableViewController : UITableViewController
{
    NSArray *StateList;
}

@property (nonatomic, retain) NSArray *StateList;

- (void) buildStateList;

@end

StateTableViewController.m

- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView
{
    return 1;
}

- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
    return [StateList count];
}

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
    static NSString *CellIdentifier = @"Cell";

    UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];

    if (cell == nil) {
        cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier];
    }

    NSInteger rowNumber = indexPath.row;
    NSString *stateName = [StateList objectAtIndex:rowNumber];

    cell.accessoryType = UITableViewCellAccessoryDisclosureIndicator;
    cell.textLabel.text = stateName.capitalizedString;

    return cell;
}

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
    [tableView deselectRowAtIndexPath:indexPath animated:YES];

    NSInteger rowNumber = indexPath.row;
    NSString *stateName = [StateList objectAtIndex:rowNumber];

    [[self.navigationController.viewControllers objectAtIndex:2] setTitle:stateName.capitalizedString];
}

StateTrendViewController.h

    #import <UIKit/UIKit.h>

@interface StateTrendViewController : UIViewController
{
    IBOutlet UIWebView *StateTrendView;
    IBOutlet NSString *ViewURL;
}

@property (nonatomic, retain) UIWebView *StateTrendView;
@property (nonatomic, retain) NSString *ViewURL;

@end

StateTrendViewController.m

    #import "StateTrendViewController.h"

@implementation StateTrendViewController

@synthesize StateTrendView;
@synthesize ViewURL;

- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{
    self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
    if (self) {
        // Custom initialization
    }
    return self;
}

- (void) viewWillAppear:(BOOL)animated 
{
    NSString *baseURL = @"https://www.google.com/search?q=";
    NSString *state = @"test";

    NSString *fullURL = [baseURL stringByAppendingString:state];
    NSURL *url = [NSURL URLWithString:fullURL];

    NSURLRequest *requestObj = [NSURLRequest requestWithURL:url]; [StateTrendView loadRequest:requestObj];
}

I need to replace the static setting with the sting passed to the controller using the ViewURL property I have setup:
NSString *state = @"test";

I am using a Storyboard in my project in Xcode 4.2.1. How should I go about passing that string value to my controller?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-29T20:51:36+00:00Added an answer on May 29, 2026 at 8:51 pm

    If all you are passing is a string, the simplest way might be to define a property on your the view controller you are presenting to hold the string. I notice you already have one, *ViewURL defined, but I’m not sure if that’s what you’ve setup for this specific task or if that is already intended for something else.

    Based on the code you’ve shared, I’m assuming that in your didSelectRowAtIndexPath in your table controller, the controller you are setting the title, and presumably later pushing, is an instance of a StateViewController:

    [[self.navigationController.viewControllers objectAtIndex:2] setTitle:stateName.capitalizedString];
    

    If this line does indeed reference an instance of StateTrendViewController, you would assign your string in the same way you’re assigning title. This needs to be set before you segue into the new view controller (I don’t see that code):

    [[self.navigationController.viewControllers objectAtIndex:2] setViewURL:@"MyPassedString"] //assign custom property
    

    When your view controller appears on screen, it will have it’s property ViewURL already set.

    Also note that your naming style for instance variables is not a standard cocoa convention, ivars beginLowerCase. Additionally, it is unusual and may not work to push a TabBar controller inside an existing nav controller, presumably from table view view controller inside an existing nav controller. Typically a TabBar is considered a top-level navigational construct, and you may wish to rethink your architecture accordingly.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a UITableView that's populated using core data & sqlite. I'd like to
How do I have a UITableView be notified that the data it is using
I'm using a UITableView to display custom cells created with Interface Builder. The table
i'm having 2 problems using uitableview custom headers: 1) The bigger one is that
I've got a UITableView that is setup using the 'Grouped' style, however I want
In my application i am using UITableview. In that delegate method didselectrow if i
I'm using a UITableView to show some data from an array. This array can
I'm using a UITableView to layout content 'pages'. I'm using the headers of the
I have created a UItableView using the default Xcode template and configure it to
I am setting the row height of my UITableView using following code [tableView setRowHeight:

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.