macOS/iOS API解説

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

目次

setAssociatedPoints:atIndex:

INDEX>AppKit>NSBezier

指定したエレメントを修正します

Objective-C

- (void)setAssociatedPoints:(NSPointArray)points
                    atIndex:(NSInteger)index

Swift

func setAssociatedPoints(_ points: NSPointArray,
                 atIndex index: Int)

解説

点であるインデックスでエレメントと結合される点を修正します。
このメソッドは、レシーバーを修正する。
NSBezierPathは、ラインエレメントから成る。

返り値

なし

引数

位置
Objective-C

(NSPointArray)points

Swift

points: NSPointArray

インデックス
Objective-C

(NSInteger)index

Swift

atIndex index: Int)

フレームワーク

ApplicationKit

クラス

NSBezierPath

使用可能

10.0

参照

例文

Objective-C

#import "MyView.h"

@implementation MyView

//NSViewのサブクラス MyViewのDrawRectに上書き
-(void)drawRect:(NSRect)rect
{
NSBezierPath *thePath = [NSBezierPath bezierPath];
NSPoint points = NSMakePoint(20.0, 20.0);

//[thePath moveToPoint: NSMakePoint(0.0, 0.0)];
//○を描く
[thePath appendBezierPathWithOvalInRect:NSMakeRect(50,50,100,100)];
//変更前を描画
[[NSColor blueColor] set];
[thePath stroke];
//○の3つめのポイントをpointsに近づける
[thePath setAssociatedPoints: &points atIndex: 3];
//変更後を描画
[[NSColor redColor] set];
[thePath stroke];
}

@end

Swift