Hmm... I'm not 100% sure but you're using button type UIButtonTypeDetailDisclosure
which has a fixed size.
Try just setting the centre of it instead of the frame.
myDetailButton.center = CGPointMake(12, 12);
instead of ...
myDetailButton.frame = CGRectMake(0, 0, 23, 23);
Also the f
is not required and IIRC it actually can take more memory than necessary when used. Just use 23
or 23.0
instead of 23.0f
. I'll have to find a reference for this though.
EDIT
Having said that I just saw your timing stats at the bottom of the question.
The percentages you are seeing here are relative. 0.173ms is almost no time at all.
You might get a better performance improvement by not running the function so many times. You're running it 700 times. Thats a LOT! Do you really need to run it that many times. You can't even fit that many buttons onto the screen at once.
Maybe you need to dequeue them instead? You're using an MKMapView
after all.