For some categories of full screen Apps, we may want components of the GUI to simply fade away if the mouse is not moved. We can do this in our iSight Recorder App by using a custom subview to monitor mouse moved events.
First, we need to create a new file that uses the Mac OS X Objective-C class template.
We can refer to the new class as BTSViewController and make it a subclass of NSView.
After we create the class files we need to assign it, in the
.xib
file, to the Custom Class of the content view of the iSight Recorder window.Tip
Receiving mouseMoved events
The conditions under which a view receives
mouseMoved
events are that the window acceptsmouseMoved
events and that the view accepts first responder. It is a simple set of conditions but since by default neither condition is true, the program code required to enable a view to receivemouseMoved
events eludes many programmers.We can use the
acceptsFirstResponder
method in ourNSView
subclass...