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 6812623
In Process

The Archive Base Latest Questions

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

I am making an app using a utility application template. I am trying to

  • 0

I am making an app using a utility application template. I am trying to access the value of a UITextField from the FlipSideVewController class.

In the MainViewController.h file I have –

@interface MainViewController : UIViewController <UISplitViewControllerDelegate>{

UITextField *textField;
NSString *myText;
}

@property (retain, nonatomic) IBOutlet UITextField *textField;
@property (nonatomic, retain) NSString *myText;
-(IBAction)pressButton:(id)sender;

In the MainViewController.m file –

myText = [[NSString alloc] initWithFormat: textField.text];
NSLog(@"%@",myText);

I am creating the FlipSideViewController in the MainViewController class using the following code –

FlipsideViewController *controller = [[[FlipsideViewController alloc] initWithNibName:@"FlipsideViewController" bundle:nil] autorelease];
controller.delegate = self;
controller.modalTransitionStyle = UIModalTransitionStyleFlipHorizontal;
[self presentModalViewController:controller animated:YES];

This prints the value of the textfield in the console without any problems. The problem happens when I try to access the value of the textfield in the FlipSideVewController class (after the user presses the go button).

In the FlipViewController class I have –

MainViewController *obj = [[MainViewController alloc] init ];
NSString *abc = obj.textField.text;  
NSLog(@"%@",abc);

The FlipSideVewController nib file is loaded fine without any problems. However the console output is (null) when in FlipSideVewController.

I will appreciate any help.

Thanks

  • 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-26T20:28:16+00:00Added an answer on May 26, 2026 at 8:28 pm

    You should go to your MainViewController and declare your textField as a property first and synthesize it, so you can access it using obj.textField. And if you have just created obj using alloc and init, you wont have any text in the textField instance Variable.

    MainViewController.h

    @property (retain) UITextField *textField;
    

    MainViewController.m

    @synthesize textField;
    

    and you could use

    myText=textField.text;
    

    Now this should do it and you can access this textField by obj.textField in your other class. But you still wont get its value if you are initializing it in your other class because you will be creating a brand new obj whose textField.text will be blank( unless you have overrided its designated initializer to set the textField.text value).

    Declare NSString *abc as instance variable

    NSString *abc;
    

    and then as property

    @property (copy) NSString *abc;
    @synthesize abc;
    

    After you create your FlipSideViewController,

    controller.abc=myText;
    

    Remove the code where you create obj.
    This will do it.

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

Sidebar

Related Questions

Ok so I'm making a simple web app using the technologies from the topic,
I'm trying to creating a web app using GWT. In my application, I use
I'm making an OpenGLES Android app using Android NDK, expanding from android's gljni example,
I am making a app in this app i am using uitextfield on table
I'm making an App using Adobe Flex/Air. I was wondering if there is any
We recently built a web app using Prototype, making a fair amount of use
I am using CoreData with iPhone SDK. I am making a notes app. I
I am making a little GUI frontend for a app at the moment using
I am making a PHP utility that imports and analyzes a CSV file into
Im making a portion of my app using the netbeans gui editor. Great so

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.