ProgressView weird behavior


hello there! i'm beginner in ios developing , , trying build small app there's comparison of 2 progressviews' progress.

button1 meant decrease progress2.progress while button2 increases it.

start button touchable on beginning of game , purpose hide information , launch first level.

point of game maintain progress2.progress close progress1.progress during small interval of time. , user should tap buttons rapidly reach game's objective.

on each turn random value progress1.progress given therefore if user can maintain progress2.progress close progress1.progress , "game" continues , new random value given progress1.progress.

problem: supposing user able pass first turn or level , , without forgetting first level went smoothly , when user reaches second level , progress1.progress starts taking random values without stopping. , , if user taps button1 or button2 game directly ends.

causing issue? tried creating different timers , many changes in newgame , still no solution... tried inactivate timers before repeat again , nothing helps.

here piece of code:

code:
- (void)viewdidload    {        progress1.progress=arc4random() % 11 * 0.1;      label1.hidden = no;      gameover.hidden = yes;            [super viewdidload];        }        -(void)regulator{        timer4 =[nstimer scheduledtimerwithtimeinterval:4 target:self selector:@selector(conditioner) userinfo:nil repeats:yes];             ;}      -(void)conditioner {          if (fabs(progress2.progress-progress1.progress)<=0.3              )            {                [self newgame];            } else{          gameover.hidden=no;         }  }      -(void)newgame{              progress1.progress=arc4random() % 11 * 0.1;}        - (ibaction)start:(uibutton *)sender {        progress2.progress=arc4random() % 11 * 0.1;        timer1 = [nstimer scheduledtimerwithtimeinterval:4 target:self  selector:@selector(regulator) userinfo:nil repeats:yes];          [self regulator];        label1.hidden=yes;        uibutton *button1 = (uibutton *)sender;      button1.enabled = no;        uibutton *button2 = (uibutton *)sender;      button2.enabled = no;      }              - (ibaction)button1:(uibutton *)sender {        progress2.progress=progress2.progress-0.04;      [self regulator];         }        - (ibaction)button2:(uibutton *)sender   {     progress2.progress=progress2.progress+0.04;  [self regulator];   }
 



Forums iPhone, iPad, and iPod Touch iOS Programming


  • iPhone
  • Mac OS & System Software
  • iPad
  • Apple Watch
  • Notebooks
  • iTunes
  • Apple ID
  • iCloud
  • Desktop Computers
  • Apple Music
  • Professional Applications
  • iPod
  • iWork
  • Apple TV
  • iLife
  • Wireless

Comments

Popular posts from this blog

Carrier post Error specific

How to increase vRAM for HD3000 graphics

Carrier [Information] AT&T NEXT