Hey Pravin.... This is one of the examples that comes with Cocos, adding and removing a UIView... If you haven't read the readme in the forum yet, check it out. It's got some good pointers on where to find example code:
http://www.cocos2d-iphone.org/forum/topic/3
From the readme:
Is there any example code?
cocos2d comes with a set of demo's (you may have cut these away if you followed the Monocle studios tutorial). Look through the example code included in the cocos2d distribution you are working in, the sample code is updated along with the distribution so what may have worked in version 0.7 may not be relevant for version 0.8.1.
The following tip from the Wiki may help you get up and running with the examples:
1. Open the cocos2d xcode project
2. Click: Xcode → View → Customize toolbar
3. Then, drag Active Target and Active Executable to your top project tool bar.
4. Select the test you want to view in both drop downs and hit Build and Go
In your case, you could select "AttachTest" in the Active Target / Active Executable dropdowns, and you'll find a demo that does what you want.
To get to the source used for the demo, in the Tree on the left in XCode,
- Choose "Targets"
- Choose "Attach Test"
- Choose "Compile Sources"
The list of files you see in here contain the code to run that example.
Good luck! And be sure to read that whole readme post in the forum, as it's got tons of good tips!
http://www.cocos2d-iphone.org/forum/topic/3