Gordon Apple wrote:
> There must already be an array for the table, so just iterate the
array every
> minute or whatever (single repeating timer), compare the times to
[NSDate
> date} and start or shut down whatever has not been started or shut
down. Much
> easier than trying to manage timers.
You don't have to iterate the whole array, either. Sort it by
ascending order of turn-off time. Keep a current position (index).
If the time of day is less than the turn-off time of the device at
the current position, do nothing. If time of day >= turn-off time of
current position, then turn it off and advance position until time of
day is again less than the turn-off time of device at the current
position. Only needs one timer, and scales to as large an array as
you want to keep.
-- GG
_______________________________________________
Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com
This email sent to arch...@mail-archive.com