Hello I am new to Cocoa programming and I met a problem about NSRectFill.
There is one button in the window, and the following is my AppDelegate.m file:
@implementation LGAppDelegate
- (void)applicationDidFinishLaunching:(NSNotification *)aNotification
{
[[NSColor redColor] set];
NSRectFill(NSMakeRect( 50,50,10,10));
}
- (IBAction)buttonPressed:(id)sender
{
[[NSColor greenColor] set];
NSRectFill(NSMakeRect( 60,60,10,10));
}
@end
What I expected to see is a rectangle shows when the application starts, and another rectangle shows after clicking the button. However, only one rectangle shows, nothing happened after clicking the button. Please help me to solve this. Thank you. Yours, Z
See Question&Answers more detail:os