Show Categories & Top Posts

Daily Archives: September 27, 2011

Unfortunately Apple does not give developers access to the ambient light sensor on the top of it’s iOS devices (used to measure brightness and adjust the screens brightness accordingly), and when I say access I mean direct access to it’s output rather the proximity state that can be inferred from it. This leaves us with

Transforms in iOS are great, very easy to create and use, as long as you only want to rotate, translate or scale. In a project we completed a while back we needed to distort the text on a switch type button to make it look like the text followed the contour of the button’s edges. We tried rotating but that looked strange when the corners of the text poked out, we needed to keep the left and right edges straight like a parallelogram, we needed a ‘distort’ transform. The CGAffine methods don’t support distorting, so we had to make the transform ourselves. It is actually very easy, just implement these two defines in your project and use them like you would use the scale, rotate or translate functions.