macOS/iOS API解説

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

目次

controlPointBounds

INDEX>AppKit>NSBezier

制御点も含むレシーバーのパスのボックスを返します

Objective-C

@property(readonly) NSRect controlPointBounds

Swift

var controlPointBounds: NSRect { get }

解説

制御点も含むレシーバーのパスのボックスを返します。

サンプル 緑の矩形がcontrolPointBounds
f:id:jjj777:20150314190543g:plain

設定値

矩形
Objective-C

@property(readonly) NSRect controlPointBounds

Swift

var controlPointBounds: NSRect { get }

フレームワーク

ApplicationKit

クラス

NSBezierPath

使用可能

10.0

参照


bounds - Cocoa API解説(iOS/OS X)

例文

Objective-C

#import "MyView.h"

@implementation MyView

//NSViewのサブクラス MyViewのDrawRectに上書き
-(void)drawRect:(NSRect)rect
{
NSRect pathBounds;
NSBezierPath *thePath1 = [NSBezierPath bezierPath];
[thePath1 setWindingRule:NSEvenOddWindingRule];

[thePath1 moveToPoint:NSMakePoint(20,20)];

[thePath1 appendBezierPathWithOvalInRect:NSMakeRect(50,50,100,100)];
[thePath1 appendBezierPathWithOvalInRect:NSMakeRect(20,20,80,80)];



[[NSColor redColor] set];
[thePath1 fill];
pathBounds = [thePath1 controlPointBounds];
NSLog([NSString stringWithFormat:@"x:%.1fy:,%.1f,width:%.1f,height:%.1f",pathBounds.origin.x,pathBounds.origin.y,pathBounds.size.width,pathBounds.size.height]);

}

@end

Swift