Cocoa Keyboard Events - nextkeyview

1. Cocoa Keyboard Events
  1) Firstly, The view who forwards the event to the key window is pointed by a window outlet called "firstResponder".
  可以在interfacebuilder中,手动设置初始化nib时的firstResponder, 并可以通过连接nextKeyView来设置哪个控件为下一个Responder当使用"Tab"健后。 通常,当一个view重写了一个keyDown消息后,keyDown的消息将被该view拥有,也就是说,该view将在执行keyDown函数中的代码而不保留原来预想中的beha vior,在keyDown中一般使用   [self interpretKeyEvents:[NSArray arrayWithObject: event]],但是在一个customView中需要重写[responderInstance interpretKeyEvents:]中所有用到的函数,详细函数可以在xcode中查到。
  2)NSTrackingArea: An de style="font-size: 11px; font-family: Monaco, Courier, Consolas, monospace; ">NSTrackingAreade> object defines a region of view that generates mouse-tracking and cursor-update events when the mouse is over that region.
改类的解释没有什么可以多说的,就是在view上创建出一个矩形区域来响应一些进入,出去,光标变化等消息。注意,这个area是属于他的view的而不是他的窗口。

With de style="font-size: 11px; font-family: Monaco, Courier, Consolas, monospace; ">NSTrackingAreade>, you can configure the scope of activity for mouse tracking. There are four options:

  • The tracking area is active only when the view is first responder.

  • The tracking area is active when the view is in the key window.

  • The tracking area is active when the application is active.

  • The tracking area is active always (even when the application is inactive.

当添加了一个NSTrackingArea后 需要重写mouseEntered: 和mouseExited:这两个method以来设置自己需要做的事情.NSView当然也能remove这样一个area,[viewInstance removeTrackingArea:].

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值