ios - UIButton won't generate randomly when score is added? -


i having problem coding on xcode. making app in target appears, have tap it, time allowed between each tap shortens gradually.

my problem: whenever try , make uilabel update after tap, target goes it's original position on view controller. have relevant code here:

-(ibaction)startbuttonpressed:(id)sender {      startbutton.hidden = yes;     text.hidden = yes;      targx = arc4random() %769;     targy = arc4random() % 925;      target.center = cgpointmake(targx, targy);      target.hidden = no; }  -(ibaction)targettapped:(id)sender {      [time invalidate];      targx = arc4random() %769;     targy = arc4random() % 925;      [self scoreadd:(id)sender];      target.center = cgpointmake(targx, targy);     timemax = 5 - (score * 0.05);      if (score >= 90) {         timemax = 0.5;     }      time = [nstimer scheduledtimerwithtimeinterval:timemax target:self selector:@selector(lose:) userinfo:nil repeats:no];  }  -(void)lose:(id)sender {      target.hidden = yes;     text.hidden = no;  }   -(void)scoreadd:(id)sender{      score = score + 1;     scorelabel.text = [nsstring stringwithformat:@"score: %li", score];  } 

print targx = arc4random() %769; targy = arc4random() % 925;

in both methods , check whether getting proper points. , check generated points lies in device screen.


Comments

Popular posts from this blog

android - MPAndroidChart - How to add Annotations or images to the chart -

javascript - Add class to another page attribute using URL id - Jquery -

firefox - Where is 'webgl.osmesalib' parameter? -