Please do not post the same thing multiple times. The board software automatically flags certain posts as needing moderator attention. This happens the most often for new users. I'm pretty sure this is made clear at the time you attempt to post. Posting the same thing over and over again just makes that many more posts the moderators have to weed through later. This makes us sad. Don't make us sad. If your post/thread doesn't appear, just wait a while. Don't post it again. If it hasn't shown up by the next day, then you can try again. I normally go through posts in the mornings, and try to check a few times throughout the day, but I'm not here 24/7. There will typically be a significant delay before posts are approved. Just be patient.
Is there a way to 1) create an instance of myClass then rotate it 45 degrees before adding it to a superview, 2) rotate just the image property 45 before adding to superview, 3) rotate the image property before drawing it in the rect, or 4) rotate the loadedImage before passing it to the image property?
CGAffineTransforms are what you are looking for and this is one of the rare cases where the Cocoa documetation is actually useful: CGAFFINETRANSFORMS doc
or for scaling: CGAffineTransform CGAffineTransformScale ( CGAffineTransform t, CGFloat sx, CGFloat sy );
so say your UIimageView is called "thingy", to make it face the oppisite direction (right to left) you would thingy.transform = CGAffineTransformScale ( thingy.transform, -1, 1);
they use matrix transformations (hey school really was important) if this doesn't help hit this thread again I'll see what I can do.
Thanks bro, I think my problem was I was trying to use a UIImage which apparently doesnt have a .transform property. So i switched over to a UIImageView instead, now it works like a charm using your "thingy" example, just swapping in my ImageView's name.
Thanks bro, I think my problem was I was trying to use a UIImage which apparently doesnt have a .transform property. So i switched over to a UIImageView instead, now it works like a charm using your "thingy" example, just swapping in my ImageView's name.
No problem brotato. It's what we are all here for; it's like a neverending "lessons learned" forum.
No problem brotato. It's what we are all here for; it's like a neverending "lessons learned" forum.
It's been to long since I've been in school to remember the details of matrix transformation! :) I've found a whole bunch of examples...I'll post them in a sec about making the square image into a parallelogram... but I can't seem to get it working.
Basically I need to make the vertical and horizontal parallel "lines" of the photo further apart or closer together...
I have been working on something similar and managed to get an image to rotate in response to the accelerometer. It was not simple or I would just reproduce my steps but I can tell you that you are on the right track.
the end result of all the setup was this little chunk of code.
Replies
CGAFFINETRANSFORMS doc
and there is also this great tutorial using Affine transforms:
http://iphonedevelopment.blogspot.com/2008/10/demystifying-cgaffinetransform.html
From the documentation:
CGAffineTransform CGAffineTransformRotate (
CGAffineTransform t,
CGFloat angle
);
so say your UIimageView is called "thingy", Make it rotate 90deg
thingy.transform = CGAffineTransformRotate (
thingy.transform,
M_PI/2); // Pi/2 is 90 degrees remember this?
or for scaling:
CGAffineTransform CGAffineTransformScale (
CGAffineTransform t,
CGFloat sx,
CGFloat sy
);
so say your UIimageView is called "thingy", to make it face the oppisite direction (right to left) you would
thingy.transform = CGAffineTransformScale (
thingy.transform,
-1,
1);
they use matrix transformations (hey school really was important) if this doesn't help hit this thread again I'll see what I can do.
- Spam
- Abuse
- Troll
0 • Off Topic Insightful Disagree Dislike Like AwesomeI think my problem was I was trying to use a UIImage which apparently doesnt have a .transform property. So i switched over to a UIImageView instead, now it works like a charm using your "thingy" example, just swapping in my ImageView's name.
- Spam
- Abuse
- Troll
0 • Off Topic Insightful Disagree Dislike Like Awesome- Spam
- Abuse
- Troll
0 • Off Topic Insightful Disagree Dislike Like AwesomeBasically I need to make the vertical and horizontal parallel "lines" of the photo further apart or closer together...
Thanks for any help! Getting the links now...
Aaron (wiegerthefarmer)
- Spam
- Abuse
- Troll
0 • Off Topic Insightful Disagree Dislike Like AwesomeiPhone image stretching (skew) - Stack Overflow
iphone - How do I create and apply the image skew transform that I have calculated? - Stack Overflow
iphone - Z direction UIview rotating? - Stack Overflow
tumbljack
I'm heading up to get a coffee...5am...can't sleep... and I'll see if I can piece this together...
Any help or links would be wonderful. The answer is always out there...but not enough hours to google And code magic!!
Looks like I might have found my solution...
iphone - UIView perspective transform - Stack Overflow
This
- Spam
- Abuse
- Troll
0 • Off Topic Insightful Disagree Dislike Like Awesomethe end result of all the setup was this little chunk of code.
CATransform3D rotationTransform = CATransform3DIdentity;
rotationTransform = CATransform3DRotate(rotationTransform, bubbleRotation, 0, 0, 1);
bubbleView.layer.transform = rotationTransform;
I think when your trying to change perspective its best to do it seperately. this makes it easier to keep track of the coords.
Hope this is helpful!
:cool:
- Spam
- Abuse
- Troll
0 • Off Topic Insightful Disagree Dislike Like Awesome