Randomly move the uibutton some 8 static position using timer in ios [closed]

  • save those 8 positions in 8 CGRects.
  • then generate a random number between 1 and 8 using int r = arc4random() % 8;.
  • using switch statement set the CGRect of the button depending on r.

Leave a Comment