Advertise Mobile SDKs Books Events Forum News Social Networking Support Us
Follow @iphonedevsdk on Twitter

Interface 2, Advanced iOS
Mockup & Code Gen
($9.99)

Make your own iPhone apps
and run them live!
(free)

Pic Frame Dynamo: Photo Editing
($0.99)

Abiliator
($1.99)

Want your application or service advertised on iPhone Dev SDK?

Go Back   iPhone Dev SDK Forum > iPhone SDK Development Forums > iPhone SDK Development

Reply
 
LinkBack Thread Tools Display Modes
Old 03-10-2011, 04:46 AM   #1 (permalink)
Registered Member
 
Join Date: Mar 2011
Posts: 25
BarryK88 is on a distinguished road
Default Rotate device and translate image goes wrong (help)

I got several images within my view. When i rotate my device I'd like to have my images being translated with the CGAffineTransformTranslate method so that the images are placed properly within my Landscape View. After I rotate back to Portrait the opposit translation needs to take place.

The translation works so far. However the translation is also being done when I touch and drag the image. How can I make sure that the translation only works on rotation and not with touch and drag.

Here's a part of my code so far:

Code:

Code:
-(void) touchesMoved: (NSSet *)touches withEvent: (UIEvent *) event {
		
		UITouch *touch = [[event allTouches] anyObject];
		CGPoint location = [touch locationInView:self.view];
		
		
		if ([touch view] == image1) {
			
			image.center = location;		
			
		}

}

-(void)didRotateFromInterfaceOrientation: (UIInterfaceOrientation)fromInterfaceOrientation  {
	
	if(fromInterfaceOrientation == UIInterfaceOrientationPortrait ||
	   fromInterfaceOrientation == UIInterfaceOrientationPortraitUpsideDown) {
			image1.transform = CGAffineTransformTranslate(image1.transform, -64, 145);
}

if(fromInterfaceOrientation == UIInterfaceOrientationLandscapeLeft ||
	   fromInterfaceOrientation == UIInterfaceOrientationLandscapeRight) {
		image1.transform = CGAffineTransformTranslate(image1.transform, 64, -145);
}
Hope someone got an answer this is bothering me for a few days now. Thanks in advance
BarryK88 is offline   Reply With Quote
Reply

Bookmarks

Tags
drag, image, rotation, transform, translate

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



» Advertisements
» Online Users: 363
13 members and 350 guests
Absentia, akphyo, apatsufas, BinHex, fredidf, Gaz, gmarro, jeroenkeij, Kirkout, MarkC, mottdog, whitey99, Wikiboo
Most users ever online was 1,387, 04-10-2012 at 04:21 AM.
» Stats
Members: 175,667
Threads: 94,120
Posts: 402,898
Top Poster: BrianSlick (7,990)
Welcome to our newest member, host number one
Powered by vBadvanced CMPS v3.1.0

All times are GMT -5. The time now is 03:22 AM.
Powered by vBulletin® Version 3.8.0
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.3.0