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

  • SEARCH
  • Home
  • 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 7067941
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T05:15:45+00:00 2026-05-28T05:15:45+00:00

I know this has been asked many times, but I cant find answer to

  • 0

I know this has been asked many times, but I cant find answer to my problem.

I want to extract a string variable from another file.

I wrote such:

NSMutableString *universalString; in AppDelegate.m

I import this string in MainViewController.m:

extern NSMutableString *universalString;

In

`- (void)tableView:(UITableView *)tableView1 didSelectRowAtIndexPath:(NSIndexPath *)indexPath

{

    [tableView1 deselectRowAtIndexPath:indexPath animated:NO];

    TestViewController *viewCon = [[TestViewController alloc]initWithNibName:@"viewCon" bundle:nil];

    [self.navigationController pushViewController:viewCon animated:YES];        
    [viewCon release];

`universalString = [self.array objectAtIndex:indexPath.row];

}`

In TestViewController.m, also extern NSMutableString *universalString;

- (void)viewDidLoad {


    UITextView *newtextview = [[UITextView alloc] initWithFrame: CGRectMake(10, 10, 200, 200)];
    newtextview.backgroundColor = [UIColor blackColor];

    [newtextview setTextColor:[UIColor whiteColor]];    
    newtextview.text = universalString;

    [self.view addSubview:newtextview];
    [newtextview release];
}

I want to extract this universalString from MainViewController., but nothing happens until I click twice forth and back through, then this universalString appear in TestViewController.m.

What did I do wrong?

  • 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-28T05:15:46+00:00Added an answer on May 28, 2026 at 5:15 am

    Ok I found a little bit of code in my email, you should hopefully be able to apply it:

    What you have to do is create an app delegate with universalString set up as a property. Include it in both view controllers, and use the following to set/get it.

    NamedAppDelegate* navigationDelegate = (NamedAppDelegate *)[[UIApplication sharedApplication] delegate];
    
    newtextview.text = navigationDelegate.universalString; //get
    navigationDelegate.universalString = "string"; //set
    

    Again, I’m a bit rusty(and can’t check my own source code because I don’t have access anymore), I hope this is enough for you to be able to apply it.

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

Sidebar

Related Questions

I know this has been asked many times, but I can't find an answer
I know this has been asked many times but i'm yet to find a
I know this question has been asked many times, but my problem is a
hello i know this has been asked and answered many times but i cant
I know this question has been asked many times before but I can't find
I know this has been asked many times before, but i still can't seem
I know this has been asked thousands of times but I just can't find
I know this has been asked many times but its been more for MVC1.
I know this is a question that has been asked many times before, but
Ok, I know this has been asked many times, but my situation is a

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.