macOS/iOS API解説

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

目次

otherEventWithType:location:modifierFlags:timestamp:windowNumber:context:subtype:data1:data2:

カスタムイベントを作って返します
+(NSEvent *)otherEventWithType:(NSEventType)type:
              location:(NSPoint)location:
              modifierFlags:(unsigned int)flags:
              timestamp:(NSTimeInterval)time:
              windowNumber:(int)windowNum:
              context:(NSGraphicsContext *)context:
              subtype:(short)subtype:
              data1:(int)data1:
              data2:(int)data2:

解説

カスタムイベントを作って返します。

返り値

( NSEvent * )

イベント

引数

( NSEventType )type

タイプ

( NSPoint )location

場所

( unsigned int )flags

YES/NO

( NSTimeInterval )time

時間

( int )windowNum

ウインドウ番号

( NSGraphicsContext * )context

コンテキスト

( short )subtype

サブタイプ

( int )data1

データ1

( int )data2

データ2

フレームワーク

ApplicationKit

クラス

NSEvent

Class Methods

使用可能

10.0

参照

例文

#import "MyScrollView.h"

@implementation MyScrollView
- (void)mouseDown:(NSEvent *)event
{
NSEvent *ev = [NSEvent otherEventWithType:NSAppKitDefined
                            location:[event locationInWindow]
                            modifierFlags:nil
                            timestamp:nil
                            windowNumber:[event windowNumber]
                            context:[event context]
                            subtype:nil
                            data1:nil
                            data2:nil
                            ];

[NSApp sendEvent:ev];
NSLog([ev description]);
}

@end