Please do not post the same thing multiple times. The board software automatically flags certain posts as needing moderator attention. This happens the most often for new users. I'm pretty sure this is made clear at the time you attempt to post. Posting the same thing over and over again just makes that many more posts the moderators have to weed through later. This makes us sad. Don't make us sad. If your post/thread doesn't appear, just wait a while. Don't post it again. If it hasn't shown up by the next day, then you can try again. I normally go through posts in the mornings, and try to check a few times throughout the day, but I'm not here 24/7. There will typically be a significant delay before posts are approved. Just be patient.
So the jist is that when the user touches the screen these three items will fade in, and after 5 seconds, the items will fade out. The problem is that I want the behavior to be such that the timer is invalidated if the user touches the screen more than once in the 5 second period and have the timer reset. In other words:
0:00 - app launched 0:05 - items fade out 0:10 - user touches screen, items fade in 0:15 - items fade out 0:20 - user touches screen, items fade in 0:22 - user touches screen again, items remain visible 0:27 - items fade out
I have tried putting in a [timerFade invalidate]; in the ResetFadeItems method, but that causes a "BAD_EXC_EXCEPTION" exception. I have tried wrapping the invalidate message inside an "if (timerFade != nil) {" statement, but still get the same exception. I have also done a "timerFade = nil;" after the invalidate, to no avail.
Second, I am having trouble fitting what you suggested into my code. I am sort of new to this so please bear with me. I can use setFireDate but I still have to init the timer object so that it knows what selector to trigger, correct? If I do that I get a crash when I call setFireDate. Here is the code:
Replies
iO
- Spam
- Abuse
- Troll
0 • Off Topic Insightful Disagree Dislike Like AwesomeSecond, I am having trouble fitting what you suggested into my code. I am sort of new to this so please bear with me. I can use setFireDate but I still have to init the timer object so that it knows what selector to trigger, correct? If I do that I get a crash when I call setFireDate. Here is the code:
What am I missing? I am guessing it is something simple, so be gentle.
- Spam
- Abuse
- Troll
0 • Off Topic Insightful Disagree Dislike Like Awesomeif (timerFade){[timerFade setFireDate:[NSDate dateWithTimeIntervalSinceNow:5]];
}else{
timerFade = [NSTimer scheduledTimerWithTimeInterval:5 target:self selector:@selector(FadeItems) userInfo:nil repeats:NO];
}
In the function FadeItems ad
If you get crashes add some break points and step through your program to find the line that is crashing.
iO
- Spam
- Abuse
- Troll
0 • Off Topic Insightful Disagree Dislike Like AwesomeThank you VERY much for your help. The code you offered wasn't 100% perfect, but it led me to the solution. Here is the solution as I found it:
Again, thank you very, very much for helping me out.
- Spam
- Abuse
- Troll
0 • Off Topic Insightful Disagree Dislike Like Awesome