in these case you need a physics engine, is not something easy to do from scratch, so you can use box2d (used in Tiny wings, Angry birds, and on thousands other "indie" games)
are you using a cocos2d? if yes, it contain a template ready to use for box2d, if not, you need to check how box2d work and how you can integrate for your solution
http://www.box2d.org/documentation.html