Safari ãªã©ã®ãã©ã¦ã¶ã§å·¦å³ã«ã¹ã¯ã¤ãããã¨éå»ã®ãã¼ã¸ã¸è¡ã£ããæ¥ããã§ããã、Xcodeã ã¨ä¸ä¸ã®ã¹ã¯ã¤ãã§ããã(*.h)ã¨å®è£ (*.m)ãã¡ã¤ã«ãåãæ¿ãããã¨ãã§ãã¦é常ã«ä¾¿å©。ãã ï¼æ¬æã®ã¹ã¯ãã¼ã«ã¨éã、ã¹ã¯ã¤ãã¯ã¢ããªå´ã§å¯¾å¿ãã¦ããå¿ è¦ããã。
ã¹ã¯ã¤ã㯠10.6 ããå°å ¥ããã NSResponder ã®æ°ããã¡ã½ãã -swipeWithEvent: ã追å ããã ãã§ç°¡åã«ä½¿ããã¨ãã§ãã。
NSResponder Class Reference
ãã®ã¡ã½ããã NSWindow ããã㯠NSView ã®ãµãã¯ã©ã¹ã§å®è£ ãã¦ããã¨、ã¹ã¯ã¤ãçºçæã«å¼ã³åºããã。
- (void)swipeWithEvent:(NSEvent *)event { if ([event type] == NSEventTypeSwipe) { // ※ããã¯ä¸è¦ãããããªã // ã¹ã¯ã¤ããããæã®å¦ç } }ã¹ã¯ã¤ãã®æ¹åã¯å¼æ°ã§æ¸¡ããã NSEvent ã®å¤ deltaX 㨠deltaY ã§å¤æã§ãã。ä¸æ¹åã¸ã¹ã¯ã¤ãããå ´åã«ã¯ deltaY == -1.0 ã¨ãªã。絶対å¤ã¯å¸¸ã« 1.0ã®ããã 。以ä¸ã¯ NSEvent ã®ä¾。
NSEvent: type=Swipe loc=(325,153) time=35110.6 flags=0x100 win=0x1436e0 winNum=5070 ctxt=0x214cf deltaX=-1.000000 deltaY=0.000000ãªãã¹ã¯ã¤ã㯠10.6ããå°å ¥ãããã¤ãã³ããªã®ã§ 10.5äºæã§éçºãã¦ããå ´å、NSEventTypeSwipe ã¯å®ç¾©ãç¡ãææããã¦ã³ã³ãã¤ã«ã¨ã©ã¼ã¨ãªã。ãã®å ´åã¯èªåã§å®ç¾©ãã¦ãã。
#ifndef NSEventTypeSwipe #define NSEventTypeSwipe 31 #endif
Responses
Leave a Response