When rendering opaque non-gradient round shapes of uniform color in iOS, there are apparently three possible methods:
Using images like circle-icon.png and circle-icon@2px.png . Then you can implement the following code so that iOS automatically displays the appropriate size:
UIImage *image = [UIImage imageNamed:@"circle-icon"]; self.closeIcon = [[UIImageView alloc] initWithImage:image]; self.closeIcon.frame = CGRectMake(300, 16, image.size.width, image.size.height);
Display rounded corners and use layers, for example :.
self.circleView = [[UIView alloc] initWithFrame:CGRectMake(10,20,100,100)]; circleView.alpha = 0.5; self.circleView.layer.cornerRadius = 50; self.circleView.backgroundColor = [UIColor blueColor];
Using custom drawing libraries with something like CGContextFillEllipseInRect
What are the exact tradeoffs in performance and maintenance of these three approaches?
source share