macOS/iOS API解説

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

目次

userData

追加データを返します

解説

追加データを返します。

返り値

( void * )

追加データのポインタ

引数

フレームワーク

ApplicationKit

クラス

NSEvent

Instance Methods

使用可能

10.0

参照

+ enterExitEventWithType:location:modifierFlags:timestamp:windowNumber:context:eventNumber:trackingNumber:userData:

例文

#import "Controller.h"

@implementation Controller

- (IBAction)pushButton:(id)sender
{
int eventNumber = 10;
int trackingNumber = 20;
void *uData ;
NSString *str1 = [NSMutableString stringWithString:@"string"];

uData = (void *)[str1 cString];

NSEvent* event = [NSEvent enterExitEventWithType:NSMouseEntered
                            location:NSMakePoint(10,10)
                            modifierFlags:nil
                            timestamp:nil
                            windowNumber:[[sender window] windowNumber]
                            context:nil
                            eventNumber:eventNumber
                            trackingNumber:trackingNumber
                            userData:uData
                            ];
[NSApp sendEvent:event];
NSLog([NSString stringWithFormat:@"%d,%d",eventNumber,trackingNumber]);
NSLog([NSString stringWithCString:uData]);
}


@end