I'm working with CGContext to create a simple square with four given points (the points should make a perfect square). However, instead of a 200px x 200px square, the iPad app makes, what looks like, 680w by 300h. Am I missing something?
int beginPointX, beginPointY, gridSize, gridPadding;
gridSize = 200;
gridPadding = 10;
beginPointX = gridPadding; // padding from left border
beginPointY = gridPadding; // padding from top border
// initiate UIGraphics method
UIGraphicsBeginImageContext(self.view.frame.size);
// set context for our UIGraphics method
CGContextRef context = UIGraphicsGetCurrentContext();
// set some defaults for our CGContext
CGContextSetRGBStrokeColor(context, 0.0, 0.0, 0.0, 1.0);
CGContextSetLineWidth(context, 1.0);
CGContextBeginPath(context);
// start
// build outer box
CGRect testRect = CGRectMake(beginPointX, beginPointY, (beginPointX + gridSize), (beginPointY + gridSize));
CGContextAddRect(context, testRect);
CGContextStrokePath(context);
/*
NSLog(@"Line from %dx%d to %dx%d", beginPointX, beginPointY, beginPointX, (beginPointY + gridSize));
CGContextMoveToPoint(context, beginPointX, beginPointY);
CGContextAddLineToPoint(context, beginPointX, (beginPointY + gridSize));
CGContextStrokePath(context);
NSLog(@"Line from %dx%d to %dx%d", beginPointX, (beginPointY + gridSize), (beginPointX + gridSize), (beginPointY + gridSize));
CGContextMoveToPoint(context, beginPointX, (beginPointY + gridSize));
CGContextAddLineToPoint(context, (beginPointX + gridSize), (beginPointY + gridSize));
CGContextStrokePath(context);
NSLog(@"Line from %dx%d to %dx%d", (beginPointX + gridSize), (beginPointY + gridSize), (beginPointX + gridSize), beginPointY);
CGContextMoveToPoint(context, (beginPointX + gridSize), (beginPointY + gridSize));
CGContextAddLineToPoint(context, (beginPointX + gridSize), beginPointY);
CGContextStrokePath(context);
NSLog(@"Line from %dx%d to %dx%d", (beginPointX + gridSize), beginPointY, beginPointX, beginPointY);
CGContextMoveToPoint(context, (beginPointX + gridSize), beginPointY);
CGContextAddLineToPoint(context, beginPointX, beginPointY);
CGContextStrokePath(context);
*/
// insert set of instructions into our grid pointer
grid.image = UIGraphicsGetImageFromCurrentImageContext();
One thing to note is that I'm working on an iPad application that has its orientation locked into landscape (if that makes any difference).