iphone - iOS - Rotating view reveals background -
I have created a scene that I want to be able to rotate. Two thoughts: containerView
and a .backgroundColor red
and BackgroundImage
as a subview. Here is my code for the rotation:
- (minus) willRotateToInterfaceOrientation: (UIInterfaceOrientation) toInterfaceOrientation period: (NSTimeInterval) span {[self adjustViewsForOrientation: toInterfaceOrientation]; } - (bool) shouldAutorotateToInterfaceOrientation: (UIInterfaceOrientation) interfaceOrientation {return YES; } - (zero) adjustViewsForOrientation: (UIInterfaceOrientation) Orientation {if (Orientation == UIInterfaceOrientationLandscapeLeft = Orientation == UIInterfaceOrientationLandscapeRight) {backgroundImage.image = [UIImage imageNamed: @ "landscape.jpg"]; background image. Frame = CGRactam (0, 0, 1024, 704); Container Viv.Frame = CGRactam (0, 0, 1024, 704); Self.title = @ "" scenario "; } Else if (orientation == UIInterfaceOrientationPortrait || orientation == UIInterfaceOrientationPortraitUpsideDown) {backgroundImage.image = [UIImage imageNamed: @ "portrait.jpg"]; background image. Frame = CGRactam (0, 0, 768, 960); Containerview.fr = CGRactam (0, 0, 768, 960); Self.title = @ "" Images ";}}
The problem is that the image went rotated, but the scene is shown the background color rotate. What a nice problem The solution is (I know that I can create images to blend in one color and set the background in the same color, but this is not what I would like).
The problem A video of can be seen here:.
PS images are from the head and F demo is used to
The solution to this problem UIView or UIWindow the backgroundColor < / code> and
[UIColor blackColor]
is set. when you rotate the Safari, then the same exact thing, only black background color, as it should normally All the apps on the iPad will rotate in such a way, and the user will not see any difference.
Instead of using PS- , the RERTTOInterfaceOrien Tation: Duration:
Method, Usage willAnimateRotationToInterfaceOrientation: Duration:
Comments
Post a Comment