I have a map with many (>500) custom annotation views. Currently I am using a UIView that implements the drawRect:
method which then draws the annotations view with UIBezierPath
and other vectorish
methods (from PaintCode). I have noticed however that when loading the map it sometimes takes quite a bit of time for the pins to show up. Would it be better to use a transparent PNG or SVG? What is less memory and processor intensive? What is the best practice?
Thanks
Loading an image file using [UIImage imageNamed:]
seems less processor intensive than calling drawRect
and its associated UIBezierPath
drawing methods for each UIView
.
drawRect
is also called whenever the view is required to update, so it may be called many times.
[UIImage imageNamed:]
on the other hand, caches images, which is another optimization.