I have a game in HTML5 I wish to enclose inside a UIWebview.
I first rotated the view with an affine transform, but it was then off the mark and badly sized. I decided to set the frame to the enclosing view’s frame. It was not a good solution, as others have found. So I followed the concatenation suggestion, and I got into the curious problem that after rotating and translating, the game displays fine, but as soon as I wish to scale, the game starts misbehaving (I get psychedelic colors…), which is not of course the intended result.
CGAffineTransform rot = CGAffineTransformMakeRotation( M_PI/2.0);
CGAffineTransform tran = CGAffineTransformMakeTranslation(0, [self statusBarFrameViewRect:self.view].size.height );
CGAffineTransform tranAndRot = CGAffineTransformConcat(rot, tran);
CGAffineTransform scale = CGAffineTransformMakeScale(self.view.frame.size.height, self.view.frame.size.width);
webView.transform = CGAffineTransformConcat(tranAndRot, scale);
// [webView setScalesPageToFit:YES]; // this line seems to do strictly nothing useful to me, whether on or off.
//I hoped it would help the contents of the view to eventually size to the scaled view, if needed.
Does anyone has a pointer to what I’m doing that’s stupid?
In the end, I never found the core issue, which is probably linked to the tools used by the game designers (Unity).
Hence my solution was to do the whole UI in landscape mode and drop the rotate/translate part entirely.