objective c - I want to limit of the number of image drop in an animation IOS -


I'm new to Objective-C, I have created an app in which the bees have to fall and a bear catch them, everything It is working fine now I want to limit the limit of bees less than 20, how can someone help me?

I am not sure if any loop or drop bee method is in the loop in the timer, any input in it will be very helpful.

  bAerere = [[NSMUTABELARROR] INIT]; Timer 1 = [NSTM Scheduled Timer With Time Interval: 2 Goal: Self Selector: @Selector (DropB) User Information: Zero Repeats: Yes]; - (zero) dropbill {CGRect ScreenTrack = [[UIScreen main screen] border]; CGFloat screenwidth = screenRect.size.width; // CGFloat screenHeight = screenRect.size.height; UIImageView * beeImage = [[UIImageView alloc] initWithImage: [UIImage imageNamed: @ "Bee-honey page"]]; Int resultX = (int) roundf (screenwidth); Int randomX = 0 + rand ()% (result x -0); [BARRAAdAdd: B image]; B image.frame = CGRactam (50, -10, 50, 50); BeeImage.center = CP Pointsmake (Random X, 50); [Self.view addSubview: beeImage]; [UIView Start Permissions: @ "Beverage" Reference: NULL]; [UIView Set Animation Duration: 2]; BeeImage.center = CG PointMake (Random X, 600); [UIView commitAnimations]; }  

How are you adding bees to your application? It would be helpful to see some code. If you have a method that is like - (zero) ADBB , then you can create a variable to calculate the number of bees.

In your header file:

  @interface Some controllers: UIViewController {int _maxNumberOfBees; }  

Then in its implementation:

  - (zero) The method_use_useUsatork.or.b.barere {birerre = [[NSMUTABARARROL] INIT]; Timer 1 = [NSTM Scheduled Timer With Time Interval: 2 Goal: Self Selector: @Selector (DropB) User Information: Zero Repeats: Yes]; _maxNumberOfBees = 20; // etc ...} (zero) dropbb {{(BERRA count)> gt; = _maxNumberOfBees) {// If the number of bees is equal to or equal to _maxNumberOfBees ... NSLog (@ "too many bee!"); } And {// add your bee to the scene CGRCT screenrate = [[USScreen main screen] border]; CGFloat screenwidth = screenRect.size.width; // etc etc etc ...}}  

Hope that helps.


Comments

Popular posts from this blog

ios - How do I use CFArrayRef in Swift? -

eclipse plugin - Run java code error: Workspace is closed -

c - Error on building source code in VC 6 -