It's pretty straightforward. To get startet you should read the Event Handling Guide especially the section Handling Processed Device-Motion Data.
You just have to keep a reference to CMMotionManager and then read motionManager.deviceMotion.attitude
for example in your drawView method - a more sophisticated approach is putting it into an own thread, but in most cases there is no need to do it that way. CMAttitude provides you with Euler angles (pitch, roll, yaw), rotation matrix or quaternion representation of the gyro updates. CMDeviceMotion contains the timestamp.
You can find sample code in the teapot demo from the WWDC 2010 session videos, look at my answer in
CMMotionManager and the Gyroscope on iPhone 4. Processing is done in EAGLView and although they do more accelerometer stuff to show the difference, you will find the set up and usage of referenceAttitude.