• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
setStringValue problems with dynamically loaded views.
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

setStringValue problems with dynamically loaded views.


  • Subject: setStringValue problems with dynamically loaded views.
  • From: Kevin Brock <email@hidden>
  • Date: Wed, 17 Mar 2010 14:16:10 -0700

I have some framework code which dynamically loads some views from it's bundle,
based on parameters that are known at runtime.

Calls to setStringValue appear to be having no effect for any of my NSTextFields, either labels or editable.

Here's code that loads a custom view containing a text field from the framework bundle and then sets the text.

@interface MyTextController  : NSViewController
{
	IBOutlet NSTextField* textField;
}

@end

In the implementation:

- (id)initWithText:(NSString*)field_contents
{
	NSBundle* mybundle = [NSBundle bundleWithPath:@"/Library/Frameworks/MyFramework.framework"];
	self = [self initWithNibName:@"MyEditText" bundle:mybundle];
	if(self)
	{
		[textField setStringValue:field_contents];
	}

	return self;
}

The view is loaded successfully, and the text field shows up where it's supposed to in the top level window.

But the text isn't set.

The .xib file shows that File's Owner is the correct subclass of NSViewController, and that the NSTextField control is connected to the textField outlet.

Any ideas?

Kevin

_______________________________________________

Cocoa-dev mailing list (email@hidden)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

  • Follow-Ups:
    • Re: setStringValue problems with dynamically loaded views.
      • From: Kyle Sluder <email@hidden>
  • Prev by Date: RESOLVED: Blocked Reads
  • Next by Date: re: CoreData database sharing and migration
  • Previous by thread: Re: NSManagedObject awakeFromFetch not sent on secondary thread?
  • Next by thread: Re: setStringValue problems with dynamically loaded views.
  • Index(es):
    • Date
    • Thread