• 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
Simple NSView Question
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Simple NSView Question


  • Subject: Simple NSView Question
  • From: Justin Giboney <email@hidden>
  • Date: Wed, 20 Aug 2008 10:12:07 -0600

I think that I am really close to this... but I can't find the next step.
I am trying to build a view programatically after the application has launched. So I have a custom view that has one method:


- (void)addLabelWithText:(NSString *)text
{
NSTextField *newTextField = [[NSTextField alloc] initWithFrame:NSMakeRect(5,5,17,50)];
[newTextField setStringValue:text];
[self addSubview: newTextField];
//[self setNeedsDisplay:YES];
}


If I add the code above into the drawRect: method, it works just fine. I think I need the commented line, but whether it is commented or not, it doesn't work. What do I have to do to redraw the view with the text field?

Thank you,

Justin Giboney
_______________________________________________

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: Simple NSView Question
      • From: Andy Lee <email@hidden>
    • Re: Simple NSView Question
      • From: Andy Lee <email@hidden>
    • Re: Simple NSView Question
      • From: Justin Giboney <email@hidden>
  • Prev by Date: Embed some NSControl in the NSTableView field?
  • Next by Date: Modifying TextEdit.app
  • Previous by thread: Re: Embed some NSControl in the NSTableView field?
  • Next by thread: Re: Simple NSView Question
  • Index(es):
    • Date
    • Thread