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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T17:37:48+00:00 2026-06-08T17:37:48+00:00

I am creating some sample applications to understand the concepts of view navigation, binding

  • 0

I am creating some sample applications to understand the concepts of view navigation, binding etc in cocoa.
Here is the scenario:
I have a window that has a tab view(2 tabs) in MainMenu.Xib.
I have a text field in the first tab and label in the second tab. I want both of them to reflect the same value and I want to do this using binding. Also, I don’t want to use the views provided to me along with the tab view.

These are the steps I have done.

The view of each tab view item is set separately in the applicationDidFinishLaunching: method using the following code:

- (void)applicationDidFinishLaunching:(NSNotification *)aNotification
{
// Insert code here to initialize your application

    //initialize view controllers 
    view1=[[ViewTab1 alloc] initWithNibName:@"ViewTab1" bundle:nil];
    view2=[[ViewTab2 alloc] initWithNibName:@"ViewTab2" bundle:nil];


   //set views
    [[[myTabView tabViewItems] objectAtIndex:0]setView:view1.view];
    [[[myTabView tabViewItems] objectAtIndex:1]setView:view2.view];    


}
  • myTabView is the outlet reference of the tab view from MainMenu.xib in AppDelegate.
  • ViewTab1 is the name of the first view controller (and the xib).
  • ViewTab2 is the name of the second view controller (and the xib).

ViewTab1 has one single text field (and an associated label). I have bound this to a variable(name) declared in AppDelegate.
ViewTab2 has a label. I have bound this also to the same variable in AppDelegate.

The variable, ‘name’ is initialized in the init method of AppDelegate.

AppDelegate.h

....
NSString *name;
....
@property(strong) ViewTab1 *view1;
@property(strong) ViewTab2 *view2;
@property (assign) IBOutlet NSTabView *myTabView;

@property (strong) NSString *name;
....

AppDelegate.m

....
@synthesize myTabView;
@synthesize view1,view2;
@synthesize name;
....
- (id)init {
self = [super init];
if (self) {
    name=@"dummy";
}
return self;
....

Apart from this I haven’t done any coding in my program.

In the ViewTab1.xib I got an object and made it an instance of AppDelegate and then connected the delegate reference of the Application object(NSApplication) to the same object. (I hope this is the right way of getting the AppDelegate object.)

I did the same in ViewTab2.xib

Then I bound the text field in ViewTab1 and label in ViewTab2 to this variable in AppDelegate.

When I run the program both the text field and label shows “dummy”. But when I change the value in the text field, its not reflected in the label in the second tab( i.e. ViewTab2).

Please tell me what I’m doing 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-06-08T17:37:49+00:00Added an answer on June 8, 2026 at 5:37 pm

    I think the problem is that the objects in your xibs that you set to the app delegate class create 2 different instances of the app delegate, so changing the value of the text field changes the value of name in one instance but not in the other. That’s what you’re doing wrong, unfortunately, I can’t think of a solution at this time.

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

Sidebar

Related Questions

I’m thinking through some database design concepts and believe that creating sample data simulating
I'm creating a simple questions DB, here are some details to start: 1st off,
I am creating a JSF application. I have some items (e.g. products) from database
I have installed visual studio 2008 and i want to create some simple applications
I'm creating a web application where I need to do some design tweaks. Here
I am just trying my hand at some WinForm Applications and was creating a
I am creating a sample application to test two-phase commit (2PC). I have taken
I am creating an application which using custom view and i have designed the
Was creating a simple console application to do some prototyping and was shocked to
Background : I'm currently, for my University, creating some simple apps showcasing the possible

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.