I have a small piece of code that draws a circle as a CAShapeLayer:
- (void) viewWillAppear:(BOOL)animated { CGFloat size = MIN(self.view.frame.size.width, self.view.frame.size.height); CAShapeLayer *circleLayer = [CAShapeLayer layer]; circleLayer.fillColor = [[UIColor redColor] CGColor]; circleLayer.frame = CGRectMake((self.view.frame.size.width - size) / 2.0 ,(self.view.frame.size.height - size) / 2.0, size, size); CGMutablePathRef pathRef = CGPathCreateMutable(); CGPathAddEllipseInRect(pathRef, NULL, CGRectMake(0, 0, size, size)); circleLayer.path = pathRef; CGPathRelease(pathRef); [self.view.layer addSublayer:circleLayer]; }
The circle displays correctly on the iPad 2 and in the simulator in non-retina mode. When I switch the simulator to retina mode, the circle does not appear at all. Unfortunately, I donβt have an iPad 3 right now, so I canβt say if it works on the device itself. Can someone post what I'm doing wrong?
Update: I reported this as an error for Apple. They told me that the error is duplicated and the other error is still open. After a while, it closed, but after the last Xcode update, it still plays.
Update 2: tested on a real iPad 3. Works correctly.
source share