Monday, 15 March 2010

objective c - Cocoa: NSRectFill on button click does not work -


Hello I'm new to coco programming and I got a problem about NSRectFill.

In the one button window, and in my following is my appillegate.m file:

  @implementation LGAppDelegate - (empty) applicationDefinitional launching: (NSNetification *) An alert { [Nscillar red color] set]; NSACTFill (NSMKACT (50,50,10,10)); } - (IBAction) button pressed: (ID) Sender {[NSColor greenColor] set]; NSACTFill (NSMKACT (60601010)); } @ And   

What I was hoping to see, shows the rectangle when the application starts, and after clicking on the button shows another rectangle, however, only shows a rectangle Nothing after clicking on the button, please help me solve it. Thank you. Your, Z

Asked to launch some background, applicationDidFinishLaunching: Once the program is loading the program 'resource'.

But at this time, there may be several windows and many scenarios displayed by the application. Just Calling NSRectFill () is not enough This application will not know where to draw the rectangle (whether it is in this window or it? Even if there is only one window and It may seem obvious ... many NSVUs may appear that you are unaware .... and with computers you should be very clear with your orders.

is the bottom line : There is no 'reference' where the drawing process As the d00dle indicates, you should read it above.

When a code of a NSView is called drawRect: , then reference (Self) is already defined / defined may be attract directly to your representative's applicationDidFinishLaunching: but there is a need to define a 'context'. / P>

No comments:

Post a Comment