iphone - Create a new class and load some copies of it into the view -


OK, I have created a small application with a small ball bouncing on the screen. He was straying now I want to take more than one ball ... then I think the best way is to make a new class: ball.

How can I do this?

Thank you!

Let the ball be explained in the form of information from the first app in the variable, and the methods of any action If you think that the ball performs, it looks like an object-oriented design problem. Maybe you should take a look at the object-oriented programming guide, such as this one

but if you Asking how to create a custom object class. Put it in your ball. H:

  #import & lt; Foundation / Foundation. H & gt; @interface ball: NSobEbase {IBotlet UIButton * button; // sample example variable} @ property (retaining) UIButton * button; @end  

then in your .m file:

  #import "ball.h" @ the implementation ball @ synthesis button; - (Zero) Dailyock {[Release the button]; [Super DeLoc]; } @end  

Comments