wslsg 发表于 2015-12-31 14:13:44

Custom Views(Chapter 17 of Cocoa Programming for Mac OS X)

#import "StretchView.h"

@implementation StretchView
- (id)initWithFrame:(NSRect)rect
{
    if (!)
    {
      return nil;
    }
   
    srandom(time(NULL));
   
    path = [ init];
    ;
    NSPoint p = ;
    ;
    int i;
    for(i=0;i<15;i++)
    {
      p = ;
      ;
    }
    ;
    return self;
}
- (void)dealloc
{
    ;
    ;
}
- (NSPoint)randomPoint
{
    NSPoint result;
    NSRect r = ;
    result.x = r.origin.x + random() % (int)r.size.width;
    result.y = r.origin.y + random() % (int)r.size.height;
    return result;
}
- (void)drawRect:(NSRect)dirtyRect
{
    NSRect bounds = ;
    [ set];
    ;
   
    [ set];
    ;
}
@end
页: [1]
查看完整版本: Custom Views(Chapter 17 of Cocoa Programming for Mac OS X)