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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T06:52:25+00:00 2026-06-15T06:52:25+00:00

I have a very simple question I hope someone can answer as I start

  • 0

I have a very simple question I hope someone can answer as I start understanding bindings. I want to programmatically change my NSString value and have the NSTextField update to that value thru bindings. I have a NSTextField and NSLabel. To represent the value of the myString properly changing I have a NSButton.

  • I have NSTextField’s Value bound to myString property of App Delegate with Continuously Update Value checked.
  • I have NSLabel’s Value bound to myString Property of App Delegate.
  • I have NSButton outlet hooked to setDefault method.

When I type in NSTextField the NSLabel updates as expected but when I click the button the myString property is updated but not in the NSTextField.

What do I need to do to get the NSTextField update to the myString property????

AppDelegate.h

@interface AppDelegate : NSObject<NSApplicationDelegate>
{
   NSString *myString;
}

@property (assign) IBOutlet NSWindow *window;
@property NSString *myString;

- (IBAction)setDefault:(id)sender;
@end

AppDelegate.m

@implementation AppDelegate

@synthesize window = _window;
@synthesize myString;

- (void)applicationDidFinishLaunching:(NSNotification*)aNotification
{
   myString = @"This is a string";
}

- (IBAction)setDefault:(id)sender
{
   NSLog(@"%@", myString);
   myString = @"This is a string";
   NSLog(@"%@", myString);
}
@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-06-15T06:52:26+00:00Added an answer on June 15, 2026 at 6:52 am

    It shouldn’t be

    myString = @"This is a string";
    

    but this:

    self.myString = @"This is a string";
    

    both in -applicationDidFinishLaunching: and in -setDefault:. Don’t forget to specify self in your NSLog statements as well. You’d probably like to specify a different string in -setDefault: so that you can actually see that a change is taking place.

    One other thing: You’re effectively saying that you want to assign to myString, but that’s not appropriate for an object. Instead of:

    @property NSString *myString;
    

    you should instead use

    @property (copy) NSString *myString;
    

    or at least

    @property (retain) NSString *myString;
    

    The former is preferred because passing a NSMutableString instance effectively copies it as a NSString, while passing a NSString instance simply retains it.

    Good luck to you in your endeavors.

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

Sidebar

Related Questions

I have a very simple (rather stupid) question, I hope someone can clear my
I have a very simple question, so I hope someone will help. I have
I have a very simple question, How can I get the POST values from
I have a very simple question: Is it possible to change the price of
I have a very simple question for which I can't seem to find an
I have a -as I hope- very simple question: how to disable an UISearchBar
Very simple question I hope. I have the usual <select> box like this <select
I have, what I think/hope, is a very simple PHP question. I have made
I have what I hope is a very simple question. In fact I think
I have a very simple question. In FB tutorial https://developers.facebook.com/docs/mobile/ios/build/ it starts to login

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.