I've been trying to rotate my view based on the CMAttitude returned from CMMotionManager specifically the pitch=x and roll=y. I'm using a reference attitude to set my horizon. This works great for portrait mode but the minute i try to do it for a landscape view it goes wrong. As the phone is now rotated 90 ccw I was hoping that coremotion would know landscape was in place and keep the pitch and roll useful. Instead I still have the axis pointing their original way. To try and compensate I simply changed the sign on roll=x and switched pitch=y. This appeared to work till I held the device in front of me and the turned around 180 degrees. The view spun upside down and inverted.
My spidy sense is telling me I need to apply a proper transformation on the pitch roll and yaw to reorientate the attitude
I'm hoping some geniuses or genii can help me. Maths is obviously not a strong point of mine.