why my iphone device and simulator has different screen resolution?
- by happyzone8
i use itouch 4G has my device and i use simulator-4.2
i will just draw a rectangle as an example. i use Quartz-2d to draw
- (void)drawRect:(CGRect)rect {
// Get a graphics context, saving its state
CGContextRef context = UIGraphicsGetCurrentContext();
CGContextSaveGState(context);
// Reset the transformation
CGAffineTransform t0 = CGContextGetCTM(context);
t0 = CGAffineTransformInvert(t0);
CGContextConcatCTM(context,t0);
// Draw a green rectangle
CGContextBeginPath(context);
CGContextSetRGBFillColor(context, 0,1,0,1);
CGContextAddRect(context, CGRectMake(0,0,320,480));
CGContextClosePath(context);
CGContextDrawPath(context,kCGPathFill);
CGContextRestoreGState(context);
}
i run it in the simulator, the whole screen becomes green, then i run this on my device, only the quarter of the screen becomes green, in order to make the whole screen green on my device, i have to draw a larger rectangle
CGContextAddRect(context, CGRectMake(0,0,640,960));
seem like my device has twice resolution than the simulator,
how can i fix this?