When should I go with core graphics over images for making a custom UIButton? Is core graphics faster? Other than resolution independence, are there any other major benefits?
Additional thoughts to ughoavgfhw's comment:
Images can be cached (like when you use [UIImage imageNamed:]
). So you even won't use more memory for new buttons, except the first one displayed. (And no allocations, except memory for a new pointer).
You can use stretchable images for button creation, and avoid some (not all and not always) problems with resolution dependence:
UIImage *myImg = [UIImage imageNamed:@"myImg.png"];
UIImage *myImgStretchable = [myImg stretchableImageWithLeftCapWidth:10 topCapHeight:10];
[myButton setBackgroundImage:myImgStretchable forState:UIControlStateNormal];