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

  • Home
  • SEARCH
  • 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 7002103
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T20:53:11+00:00 2026-05-27T20:53:11+00:00

Sorry if this has been asked before or it’s a really dumb question, but

  • 0

Sorry if this has been asked before or it’s a really dumb question, but I can’t figure it out. I have an NSView in my interface, and I have created a subclass of NSView in Xcode. Then using the identity inspector, I set my NSView’s class to be the newly created NSView subclass. The view draws fine, but now I need to redraw it to change a string inside the view. I’m pretty sure this has to do with setNeedsDisplay, but what do I send the message to? I don’t have a particular instance of my view in the code, since it’s in Interface Builder, so what do I do?
Again, sorry if this is dumb. I haven’t done much with NSView yet. Ask for more info if you need it. Thanks!

  • 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-27T20:53:12+00:00Added an answer on May 27, 2026 at 8:53 pm

    In the view controller subclass you have, add an ivar with type of your NSView subclass. Declare a property on it, and mark it as an outlet.

    // ViewControllerSubclass.h
    ViewType *myView;
    
    @property(readwrite, assign) IBOutlet ViewType *myView;
    
    // ViewControllerSubclass.m
    @synthesize myView;
    

    Now you have an outlet, connect it to the view you designed via IB. To do so, right click in IB on your view controller subclass (the file’s owner), you should see the outlet in the list.

    Once you have done that, you are now able to send messages to the view in your code.
    To mark the view as needing redraw :

    [myView setNeedsDisplay:YES];
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm sorry if this question has been asked before, but I can't seem to
Sorry if this has been asked before but I've tried searching and can't find
sorry if this question has been asked before, I searched but wasn't sure on
Sorry if this has been asked before, but I can't find a clear enough
I'm sorry if this question has been asked before, but I'm not even sure
Sorry if this has been asked elsewhere. I have looked but can't find any
Sorry I know this question has probably been asked before, but do you know
Sorry if this has been asked before, but I'm wondering what the best memory
I'm sorry if this question has been asked already, but I couldn't find it
Sorry if this has been asked before, I did check but couldn't find anything...

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.