Since you are new to game dev, I would not recommend writing your own physics code if your game is relatively complex. I have two reasons for saying this:
- You need to know how to separate physics from game logic, in order to ensure the stability of the physics while maximizing flexibility of game logic.
- There are many pitfalls when it comes to designing a physics engine with collision detection, many of which have been solved in existing physics engines.
If you are still set on writing your own physics, I recommend starting by creating a sandbox application with a good existing physics engine. Look at what parts of the physics engine are exposed, and what parts you would like to have exposed. Next, dig into the physics code to see how the objects are updated according to velocity, simulation gravity, mass, friction, etc. See how collision is detected, and how the engine deals with things like tunneling and collision response for extreme cases.
Box2D is well-written open-source physics engine, and is included in Cocos2D. You can create a Box2D game template and jump right into it.