It looks like you're new here. If you want to get involved, click one of these buttons!
[timer invalidate];
//METHOD TO DETECT MOVEMENT IN iPHONE
- (void)accelerometer:(UIAccelerometer *)acel didAccelerate:(UIAcceleration *)aceler {
if (fabsf(aceler.x) > 2 || fabsf(aceler.y) > 2 || fabsf(aceler.z) > 2)
{
//TEST STATEMENT
[label setText:@\"You shook me!\"];
//SET PROGRESS BAR TO 0
progressView.progress = 0.0;
//INITIALIZE TIMER - SELECTOR TO MOVE PROGRESS
timer = [NSTimer scheduledTimerWithTimeInterval:1.0 target:self selector:@selector(moveProgress) userInfo:nil repeats: YES];
}
}
-(void)moveProgress
{
progressView.progress = progressView.progress + 0.1;
if (progressView.progress == 0.5)
{
[progressLabel setText:@\"That's a tough one...\"];
}
if (progressView.progress == 1.0)
{
//END TIMER
[timer invalidate]; //PROBLEM????
//CREAT ARRAY FROM PLIST (IDENTICAL TO FLIPSIDE LOAD)
NSString *filePath = [[NSBundle mainBundle] pathForResource:@\"answers\" ofType:@\"plist\"];
//NSLog(filePath);
NSArray *array = [[NSArray alloc]initWithContentsOfFile:filePath];
self.answerList1 = array;
[array release];
// NSLog(answerList);
//STORE TOTAL ANSWER LIST COUNT
int numAnswers = [answerList1 count];
//RANDOM SELECT AN ARRAY INDEX
int randSelected = arc4random() % numAnswers;
//STORE THAT SELECTION AS A STRING (RANDOM PLIST ITEM)
NSString *selection = [answerList1 objectAtIndex:randSelected];
//OUTPUT THAT RANDOM SELECTION
[label setText:selection];
image1.hidden = NO;
progressView.hidden = YES;
[progressLabel setText:@\"\"];
NSString *soundPath = [[NSBundle mainBundle] pathForResource:@\"fortuneSound\" ofType:@\"wav\"];
SystemSoundID soundID;
AudioServicesCreateSystemSoundID((CFURLRef)[NSURL fileURLWithPath:soundPath], &soundID);
AudioServicesPlaySystemSound (soundID);
}
}
Replies
NSTimer *timer = [NSTimer scheduledTimerWithTimeInterval:blah blah blah....];
See if thats is any better.
Impossible Locks
<a href
- Spam
- Abuse
- Troll
0 • Off Topic Insightful Disagree Dislike Like AwesomeThe Lord's holy name be praised.
- Spam
- Abuse
- Troll
0 • Off Topic Insightful Disagree Dislike Like Awesome- Spam
- Abuse
- Troll
0 • Off Topic Insightful Disagree Dislike Like AwesomeIn the .h file i have the following in the right place...
In the .m file i have the following in the right place...
I've changed around the code a bit for some of the suggestions but they did not provide any sunshine. I've got it back to what it is posted in my posts now...non functioning! LOL.
Thanks again for helping with this...can't wait to get his resolved.
- Spam
- Abuse
- Troll
0 • Off Topic Insightful Disagree Dislike Like AwesomeAlways use self.timer = [NSTimer sch....]; if you set the property
The Lord's holy name be praised.
- Spam
- Abuse
- Troll
0 • Off Topic Insightful Disagree Dislike Like Awesomeyour answer helps me solve a problem , thanks!
- Spam
- Abuse
- Troll
0 • Off Topic Insightful Disagree Dislike Like Awesome