macOS/iOS API解説

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

目次

setLineCapStyle:

INDEX>AppKit>NSBezier

ベジエパスのラインキャップスタイルをセットします

Objective-C

@property NSLineCapStyle lineCapStyle

Swift

var lineCapStyle: NSLineCapStyle

解説

ベジエパスのラインキャップスタイルをセットします
● NSButtLineCapStyle すぱっと切れた端
f:id:jjj777:20150305220529p:plain
● NSRoundLineCapStyle 丸い端
f:id:jjj777:20150305220742p:plain
● NSSquareLineCapStyle 四角い端
f:id:jjj777:20150305220822p:plain

返り値

Objective-C

Swift


    
( void )

なし

引数

Objective-C

Swift


    
( NSLineCapStyle )lineCapStyle

線端形状

フレームワーク

ApplicationKit

クラス

NSBezierPath

使用可能

10.1

参照


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


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


setDefaultLineCapStyle: - Cocoa API解説(iOS/OS X)

関連記事(外部サイト)

例文

Objective-C

//NSViewのサブクラス MyViewのDrawRectに上書き
-(void)drawRect:(NSRect)rect
{

NSBezierPath *thePath = [NSBezierPath bezierPath];

[thePath setLineCapStyle:NSRoundLineCapStyle];

[thePath moveToPoint:NSMakePoint(20,20)];
[thePath lineToPoint:NSMakePoint(120,120)];


[thePath appendBezierPathWithRect:NSMakeRect(50,50,100,100)];

[thePath setLineWidth:5];
[[NSColor redColor] set];

[thePath stroke];


}

Swift


    

更新時バージョン

10.10