example if the 开发者_如何学Gouser is idle for a predefine period?
Use NSTimer to schedule intervallic calls to a timeout method you write. This method determines if a time out should occur based on the current time and an internal time. If yes, the method takes the steps to timeout and turns off the NSTimer calls to itself. The NSTimer calls should have a pretty coarse interval so as to not use up any unnecessary resources.
Additionally, the object listing for the timeout should update its internal time based on your requirements independently of the timeout query calls. Event listening may help with this.
精彩评论