| Home 目次>ApplicationKit>NSCustomImageRep | |
delegate
デリゲートオブジェクトを返します
-(id) delegate
【返り値】 | |
| id | デリゲートオブジェクト |
【解説】
デリゲートオブジェクトを返します。
【例文】
#import "MyObject.h"
@implementation MyObject
- ( IBAction )myAction:( id )sender
{
NSSize siz = [myOutlet frame].size;
NSImage *img;
NSCustomImageRep *customImgRep = [[NSCustomImageRep alloc] initWithDrawSelector: @selector (draw) delegate: self ];
img = [[[NSImage alloc] initWithSize : siz] autorelease ];
[img addRepresentation:customImgRep];
[myOutlet setImage:img];
NSLog([[customImgRep delegate]className]);
}
-( void )draw
{
[[NSColor redColor] set];
[[NSBezierPath bezierPathWithOvalInRect : NSMakeRect( 20 , 0 , 100 , 100 )] fill ];
}
@end
![]() | |
この記事を評価してください。
| Home 目次>ApplicationKit>NSCustomImageRep | 修正日2006.12.26 |