2

私は、Objective C を使用して一般的に画像を描画するのはかなり初めてです。iPhone 開発で画像描画を行ったことがありますが、今は Mac で描画したいと考えています。要するに、以下の iPhone コードに相当する Mac は何ですか?

- (void) drawRect: (CGRect) rect
{
    [super drawRect:rect];

    UIImage *anotherimage = [UIImage imageNamed:@"alert.png"];
    CGPoint imagepoint = CGPointMake(10,0);
    [anotherimage drawAtPoint:imagepoint];

}
4

1 に答える 1

3

画像の透明度と構成効果が必要ないと仮定すると、これは機能するはずです。

-(void)drawRect:(NSRect)dirtyRect
{
    [super drawRect:dirtyRect];
    NSImage *anotherImage = [NSImage imageNamed:@"alert.png"];
    [anotherImage drawAtPoint:NSMakePoint(10,0) fromRect:rectToDrawImage operation:NSCompositeCopy fraction:1.0];
}
于 2013-11-03T23:46:40.400 に答える