macOS/iOS API解説

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

目次

mouse:inRect:

レシーバのビューの指定した範囲に指定した位置が含まれているかを返します
-(BOOL)mouse:(NSPoint)aPoint:
          inRect:(NSRect)aRect:

解説

レシーバのビューの指定した範囲に指定した位置が含まれているかを返します。

返り値

( BOOL )

YES/NO

引数

( NSPoint )aPoint

位置

( NSRect )aRect

範囲

フレームワーク

ApplicationKit

クラス

NSView

Instance Methods

使用可能

10.0

参照

- hitTest:
- isFlipped
NSMouseInRect() (Foundation Functions)
- convertPoint:fromView:

例文

#import "MyScrollView.h"

@implementation MyScrollView
- (void)mouseDown:(NSEvent *)theEvent
{

if ([self  mouse:[theEvent locationInWindow] inRect:[self frame]])
{
    NSLog(@"YES");
}else{
    NSLog(@"NO");
}
}
@end