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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T05:07:05+00:00 2026-05-29T05:07:05+00:00

I have an app with mulitple views. On view one I create and NSDate

  • 0

I have an app with mulitple views. On view one I create and NSDate as follows:

NSString *storeDate = [[NSDate date] description];

On view 2, in viewDidLoad: I want to set the value of a label (outlet etc created and linked) to storeDate value using

timeRecord.text = storeDate;

I have imported my views but storeDate is being flagged as undeclared.

Any idea how I can get this to work?

SOFViewController.h

#import <UIKit/UIKit.h>

@interface SOFViewController : UIViewController {

}
-(IBAction) storeDateBut: (id) sender;
-(IBAction) goToView2: (id) sender;
@property (nonatomic,retain) NSString *storeDate;

@end

SOFViewController.m

#import "SOFViewController.h"
#import "view2.h"

@implementation SOFViewController
@synthesize storeDate;

-(IBAction) storeDateBut: (id) sender{

    self.storeDate = [[NSDate date] description];

}

-(IBAction) goToView2: (id) sender{
    view2 *myview2 = [[view2 alloc] initWithNibName:@"view2" bundle:nil];
    [self.view addSubview:myview2.view];

}

- (void)didReceiveMemoryWarning {

    [super didReceiveMemoryWarning];

}

- (void)viewDidUnload {

}

- (void)dealloc {
    [super dealloc];
}

@end

view2.h

#import <UIKit/UIKit.h>


@interface view2 : UIViewController {
    IBOutlet UILabel *dateLabel;

}

-(IBAction) goToView1: (id) sender;
@property (nonatomic, retain) IBOutlet UILabel *dateLabel;

@end

view2.m

#import "view2.h"
#import "SOFViewController.h"


@implementation view2
@synthesize dateLabel;

-(IBAction) goToView1: (id) sender{

    SOFViewController *mySOFViewController = [[SOFViewController alloc] initWithNibName:@"view2" bundle:nil];
    [self.view addSubview:mySOFViewController.view];



}

- (void)viewDidLoad {

    dateLabel.text = SOFViewController.storeDate;
    [super viewDidLoad];
}




- (void)didReceiveMemoryWarning {

    [super didReceiveMemoryWarning];

    }

    - (void)viewDidUnload {
        [super viewDidUnload];

    }


    - (void)dealloc {
        [super dealloc];
    }


    @end
  • 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-29T05:07:09+00:00Added an answer on May 29, 2026 at 5:07 am

    Scope of storeDate is limited to method of view1. So you can not access it other views or even other method of same class. you have to make “storeDate” property then you can access it anywhere like

    @interface view1:UIView {} 
    @property(nonatomic, retain) NSString *storeDate;
    @end
    

    in implementation use

    @synthesize storeDate;
    

    now set the value of storeDate as

    self.storeDate = [[NSDate date] description];
    

    and you can use it any where.

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

Sidebar

Related Questions

I have an app where I want to have one background view (view controller
I have an iphone app, with a view (well multiple but let's say one
Lets say I have multiple DataGrids throughout my winform app and I want to
I have a single Rails 2.2.2 app that I want to 'share' with multiple
I am developing one small app in which i have multiple NSURLConnection.I have created
i need to create an iPad app where i have to show multiple tables(no
The App Layout I am building an App, where one can create surveys. Every
How would one change the view on the screen programmatically in an iPhone app?
I have an app with a navigation controller as the root view. There are
I want to create a live, checkers-like app, which will work like this: There

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.