0

I have an NSView thats used as a status item and I need to run this on/in it:

thingOne = NO;
[self setNeedsDisplay:YES];

but can't figure out how. I tried sending a notification (form another notification a class gets) but the notifications never received. I also tried to add a method to do this but it requires using a + symbol for it and I can't access the classes variables. How can this be done? (If it's even possible)

Thanks for any help

nosedive25
  • 2,477
  • 5
  • 30
  • 45
  • 1
    You are in dire need of reading up on Object-Oriented Programming and then the Model View Controller (MVC) design pattern, which Cocoa follows more or less religiously. See also Communicating with Objects section of the Cocoa Fundamentals guide in Apple's documentation. – Joshua Nozzi Feb 21 '11 at 00:39
  • I am well aware of what OOP and MVC are, but when I have had no luck I desperately looked eles where in Cocoa. – nosedive25 Feb 21 '11 at 01:05
  • So you say, but your question demonstrates otherwise: You clearly do not understand several concepts that are well explained in the documentation. Either that, or you're treating those concepts as irrelevant, when in fact they solve every problem you mention in your question. See these two documents: http://developer.apple.com/library/mac/documentation/Cocoa/Conceptual/OOP_ObjC/ http://developer.apple.com/library/mac/documentation/Cocoa/Conceptual/CocoaFundamentals/ Read them from start to finish, and apply what they explain in your application. – Peter Hosey Feb 21 '11 at 07:18

1 Answers1

0

I was able to send the notification to the app delegate. Then I added a method to the view object to change the bool and had the notification call it.

nosedive25
  • 2,477
  • 5
  • 30
  • 45
  • Routing everything through your app delegate—or any other single object—is a bad idea. It is better to keep your code organized, so you can more easily go directly to whatever part you're interested in without having to scroll through long source files. You should define a separate controller class to be in charge of the status item and its view. – Peter Hosey Feb 21 '11 at 07:10
  • I did move it into a separate class that deals only with this function. – nosedive25 Feb 21 '11 at 21:53