IPhone SDK: landscape capture mode

I want my users to draw an image on their screen in landscape mode.

When a button is pressed, this image should be stored locally on the device.

I use this sample code below, which runs vertically http://www.ipodtouchfans.com/forums/showthread.php?t=132024

My problem is that I am trying to set up the code for landscape mode with a smaller drawing area, but it does not work. I'm not sure why?

There seem to be three areas that are related to borders that the user can draw. I tried resizing, but this does not seem to work. What am I missing?

Orignally: viewDidLoad: drawImage = [[UIImageView alloc] initWithImage:nil]; drawImage.frame = self.view.frame; - (void)touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event { UIGraphicsBeginImageContext(self.view.frame.size); [drawImage.image drawInRect:CGRectMake(0, 0, self.view.frame.size.width, self.view.frame.size.height)]; ... } - (void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event { UIGraphicsBeginImageContext(self.view.frame.size); [drawImage.image drawInRect:CGRectMake(0, 0, self.view.frame.size.width, self.view.frame.size.height)]; ... } 
+6
iphone
source share
2 answers

If you only have a landscape. Then add the following code for example: -

 - (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation { if (interfaceOrientation==UIInterfaceOrientationLandscapeLeft || interfaceOrientation == UIInterfaceOrientationLandscapeRight) return YES; else return NO; } 

and go to the project properties and set the device orientation to Landscape on the left and Landscape on the right

Hope this solves your problem.

0
source share

I also use this code for painting, and when I switch to landscape mode, I again give the frame for our painting. Or the view you use for drawing. If you are giving your UIView class from the xib class, then it is better to set the landscape mode frame.

And yes, one thing is, if you do some kind of drawing in portrait mode and switch to landscape mode, then you have to adjust your last point and current points in accordance with your area.

-one
source share

All Articles