What are various ways to make a background image rotate in iOS?
-
Once you add the background image to the .xib, how can you make it rotate? For example, if you have a hypnotic swirl and want it to rotate. Photo retrieved on June 13, 2012 from: http://map-bms.wikipedia.org/wiki/Gambar:Hypnotic-spiral.jpg Or if you wanted to create a astronomy app with the planets circling the sun. In this example, there would be one sky background. then a sun image on top. Then images of planets, each planet would be drawn and then have a transparent background then stacked on top of the other. Of course they would all br programmed to have different speeds and orbital paths. I know there are various ways, what would you use and why? Please only post an answer if you have a sample of code or a discussion on technique. If you have a question, link for a tutorial, or a general comment, please add that as a comment and not an answer.
-
Answer:
If you're just trying to rotate UIView objects you can animate changes to their transform property(http://developer.apple.com/library/ios/#documentation/uikit/reference/uiview_class/UIView/UIView.html#//apple_ref/doc/uid/TP40006816-CH3-SW4). There's even a CGAffineTransformMakeRotation function specifically for creating transforms which rotate your view (http://developer.apple.com/library/ios/#documentation/GraphicsImaging/Reference/CGAffineTransform/Reference/reference.html ).
Jonah Williams at Quora Visit the source
Other answers
's answer is perfectly acceptable. The other method in iOS would be to use OpenGL with orthographic projection and use the image as a texture then rotate the geometry or camera. If you want the image to be full-screen and rotate smoothly at a high frame rate you'll want to use OpenGL. Depending on the number of layers and complexity of your solar system, OpenGL might be the only way to get acceptable FPS on 3GS, iPad 1, and pre iPhone 4 iPod Touches.
Pat Roberts
I would do something like this using the Cocos2D framework. You can make that image a sprite then use CCRotateBy action class to make it spin: Something like: [CCRotateBy actionWithDuration:2.5 angle:360] http://www.cocos2d-iphone.org/api-ref/2.0.0/interface_c_c_rotate_by.html
Giv Parvaneh
Related Q & A:
- How do I add a background image to my JFrame?Best solution by Stack Overflow
- What are some ways to make extra money while in college?Best solution by Yahoo! Answers
- What are some ways to make money?Best solution by Yahoo! Answers
- What are other ways to make teeth white?Best solution by ChaCha
- How do I make a background image full page with CSS?Best solution by stradegyadvertising.com
Just Added Q & A:
- How many active mobile subscribers are there in China?Best solution by Quora
- How to find the right vacation?Best solution by bookit.com
- How To Make Your Own Primer?Best solution by thekrazycouponlady.com
- How do you get the domain & range?Best solution by ChaCha
- How do you open pop up blockers?Best solution by Yahoo! Answers
For every problem there is a solution! Proved by Solucija.
-
Got an issue and looking for advice?
-
Ask Solucija to search every corner of the Web for help.
-
Get workable solutions and helpful tips in a moment.
Just ask Solucija about an issue you face and immediately get a list of ready solutions, answers and tips from other Internet users. We always provide the most suitable and complete answer to your question at the top, along with a few good alternatives below.