Moving Rectangle In iPhone

In this application we will see how to Rectangle moving in the application . We are using here CoreGraphics.framework , for animation behavior. So  just have a look.

Step 1: Create a Window base application using template. Give the application name “ChangeRect”.

Step 2: Xcode automatically creates the directory structure and adds essential frameworks to it. You can explore the directory structure to check out the content of the directory.

Step 3: We need to add here UIView class to the project.Choose New file -> Select cocoa touch classes group and then select UIView subclass . Give the name “CreateRectView”.

Step 4: open the AppDelegate.m file, we create a background and set the gray background color and make two different rectangle with different color. So make the following changes in the file:




Step 5: In the ChangeRectView.h file, we define two methods. Make the following changes in the file:




Step 6: Now open the ChangeRectView.m file and make the changes:




Step 7: In the main.m file, we need to provide the name of the AppDelegate class as a argument here. So make the following changes in the file:




Step 8: Now compile and run the application in the simulator.

You can downloaded SourceCode from here ChangeRect 2

Leave a Comment:

1 comment
free beats says October 28, 2012

I cherished up to you will obtain carried out proper here. The comic strip is tasteful, your authored material stylish. nonetheless, you command get got an impatience over that you want be turning in the following. ill indisputably come further earlier once more since precisely the same just about a lot incessantly inside of case you protect this increase.

Add Your Reply