macOS/iOS API解説

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

目次

isARepeat

イベントは繰り返しているかを返します

解説

キーイベントは繰り返しているかを返します。
キーイベントでなければNSInternalInconsistencyExceptionを起こします。

返り値

( BOOL )

YES/NO

引数

フレームワーク

ApplicationKit

クラス

NSEvent

Instance Methods

使用可能

10.0

参照

+ keyEventWithType:location:modifierFlags:timestamp:windowNumber:context:characters:charactersIgnoringModifier:isARepeat:keyCode:

例文

#import "MyButton.h"

@implementation MyButton

- (BOOL)performKeyEquivalent:(NSEvent *)anEvent
{
[self setTitle:[anEvent characters]];

if ([anEvent isARepeat]){
NSLog(@"YES");
}else{
NSLog(@"NO");
}
return YES;
}
@end