convertPoint:toView:
レシーバの座標を別のビューの座標へ変換してNSPointを返します
-(NSPoint)convertPoint:(NSRect)aRect:
toView:(NSView *)aView:
解説
レシーバの座標を別のビュー(aView)の座標へ変換してNSPointを返します。
別のビュー(aView)がnilなら、ウインドウの座標になります。
別のビュー(aView)とレシーバーは、同じNSWindowにないといけません。
返り値
( NSPoint )
レシーバのaViewでの座標
引数
( NSRect )aRect
変換元の範囲
( NSView * )aView
変換先のビュー
フレームワーク
ApplicationKit
クラス
NSView
Instance Methods
使用可能
10.0
参照
- convertRect:toView:
- convertSize:toView:
- ancestorSharedWithView:
- contentView (NSWindow)
例文
#import "MyScrollView.h" @implementation MyScrollView //ダブルクリックしたPointのXの値をtextFieldに入れる //このスクロールビューのmouseDownをオーバーライド - (void)mouseDown:(NSEvent *)theEvent { //ダブルクリックだったら if ([theEvent clickCount] > 1) { //スクロールビューの原点ポイントを取得してウインドウの位置に変換 NSPoint curPoint = [self convertPoint:[self frame].origin toView:nil]; //TextFieldにセット [myXPoint setIntValue:curPoint.x]; } } @end