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

View Single Post
Old 08-22-2008, 04:19 AM   #7 (permalink)
ekbart
New Member
 
Join Date: Aug 2008
Posts: 39
ekbart is on a distinguished road
Default aha progress but still struggling

Ahah, i found that if you just assign the transform to a view it doesn't seem to do anything.

so myview.transform = mytransform
is a NOP

but [myview setTransform:mytransform]
does do something.

But just rotating the view from portrait to landscape screws up the coordinates,
so you need to offset by half of the difference:

// this will transform your coordinates so that you can draw kind of normally
CGAffineTransform rotate = CGAffineTransformMakeRotation(1.57079633);
rotate = CGAffineTransformTranslate (rotate, -80.0, +80.0);
[myView setTransform:rotate];

Now I can add buttons in a convenient coordinate system.
However my view background is now shifted -80, +80 pixels, because of the translation I added to the view. How can i load a background into the view without getting fouled up by my transform?

I have a view background (currently stored as landscape):
UIImageView *myviewback = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"back_spreads.png"]];
[self addSubview:myviewback];


My background gets rotated as the transform indicates, but the translation
i put in to fix the coordinates fouls up the background, how do I fix this?
ekbart is offline   Reply With Quote
 

» Advertisements
» Online Users: 850
27 members and 823 guests
13dario13, ADY, Agenor, Ananth, baja_yu, Batman, cgokey, Christioren, dansparrow, djohnson, fkmtc, gogoman, imac74, iram901, latoncefrank, Lily.P, mer10, mkjarred, muchless, mwyld, Prajakta, Promo Dispenser, raidu, Saurman, SillyHoney, ubaid, xltke
Most users ever online was 1,387, 04-10-2012 at 04:21 AM.
» Stats
Members: 175,388
Threads: 94,003
Posts: 402,461
Top Poster: BrianSlick (7,978)
Welcome to our newest member, Christioren
Powered by vBadvanced CMPS v3.1.0

All times are GMT -5. The time now is 06:51 AM.
Powered by vBulletin® Version 3.8.0
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.