Search code examples
iphoneios6uiimageviewavaudioplayer

how long does it take to switch a UIImageview image


How long does it take to switch a UIImageview image for each version of the iPhone on average?

I'm trying to get metering enabled on an AVAudioPlayer and I want to know how often I chould check metering levels so that the image displaying the metering doesn't lag behind actual playback.


Solution

  • How long it takes to set the image is unpredictable. It also depends on where you are loading the image from, and wether it has been loaded before. [UIImage imageNamed:...] already does some optimisation when you are reusing the same image, but that doesn't mean you get predictable speed.

    If you want to do something like displaying a level meter, you might be better off doing the drawing yourself in a custom view. Override drawRect: and draw the status of the levels in your 'level' view. Us a level property and override it's setter to call setNeedsDisplay if the property value has changed.