macOS/iOS API解説

iOS , Mac アプリケーション開発のために使われる主要フレームワークの日本語情報です。2010年代に書かれた内容です。今後更新はありません。

目次

getRectsBeingDrawn:count:

描画された矩形を返します
-(void)getRectsBeingDrawn:(const NSRect **)rects:
                  count:(int *)count:

ヤマコー 檜 豆腐作り器

ヤマコー 檜 豆腐作り器

解説

描画された矩形を返します。

返り値

( void )

なし

引数

( const NSRect ** )rects
( int * )count

フレームワーク

ApplicationKit

クラス

NSView

Instance Methods

使用可能

10.3

参照

-wantsDefaultClipping

例文

- (void)drawRect:(NSRect)rect 
{
     const NSRect *rects;
     int rectIndex, rectCount;

     [self getRectsBeingDrawn:&rects 
						count:&rectCount];

     //リサイズ中か
     if ([self inLiveResize]) 
	 {
         //ウインドウ背景色で描画
		 [[NSColor windowBackgroundColor] setFill];
         NSRectFillList(rects, rectCount);
     } else {
		//リサイズ中じゃなかったら描画された部分だけ
         for (rectIndex = 0; rectIndex < rectCount; rectIndex++) {
             NSRect rect = rects[rectIndex];
             [cachedImage compositeToPoint:rect.origin 
								  fromRect:rect 
								 operation:NSCompositeCopy];
         }
     }
}