Image Sequencer using CoreAnimation - objective-c

I have a list of images (say 180 images of sequence) to animate. If I use UIImageView with its default image sequence, I get memory issue.
I wanted to use CoreAnimation API, but really don't know how to do it?
What is the best way to do this.
Regards
iWasRobot :P

There's a very hard to google example on how to perform view transitions with Animation, here it is:
http://developer.apple.com/library/ios/#samplecode/ViewTransitions/Introduction/Intro.html
Here you would need as little as 2 views. You would load images into the hidden view, then "transition" it in. Assuming your slideshow mode is long enough, you should have no issues with loading times.
Another thing that comes to mind is paging with UIScrollView. Here you would need as little as 3 views
http://ykyuen.wordpress.com/2010/05/22/iphone-uiscrollview-with-paging-example/
I hope this helps!

Related

animation in game application in android

I am working on image animation. I have 200 transparent png images which I am trying to show one by one over a background image.
Can you tell me the best way to do it. The image should change in such a way that it should appear that a cartoon is running.
thanx
pavan
Did you end up finding a solution for this? I would be interested in knowing. If you do not need to animate quicker than every 300ms then this may work for you see my post:
See: 750 frame transparent PNG animation in ImageView at 23fps
Also using Animation.drawable could be an option if you can split your cartoon it up into small pieces 40-50 frames at a time and then play them one after the other.
I'm still looking for a better solution for this so would be interested to see another way.

Create an omnidirectional scrollview

I want to create an omnidirectional scrollview that works pretty much like the one in the "Wall of Sound" app. As in, the user should be able to pull into any direction and never get to an end. I want to keep the move to be smooth (and not see the pages change as you would in a standard scrollview). Does anyone know how that can be done? Or would I need OpenGL for that?
Create a 3x3 grid of views, each the size of the viewport. As the scrollview moves into another section, rearrange the views to constantly put the viewport in the center. In most cases 3x3 is sufficient, but if redrawing the views is expensive, you may want to use a larger grid (5x5 for instance). This requires that you have some mechanism for splitting up your full view into tiles.
You can implement the same thing using CALayer if you like. If you go that way, you should consider instead using CATiledLayer. See Matt Long's quick introduction on CIMGF.

Recreate the BookCase in iBooks

I just wanted to know how you could implement a bookcase, like in iBooks, into your iPhone app.
I presume you would need to use a UIScrollView, but then I read somewhere that you need to use a UITableView. Which is it?!
You'd use code that others have already written, such as AQGridView.
I'm not sure if there's a better way, but you could create multiple small views or images (these would represent each book) then add these small views/images to the subview of a larger view in a linear format (leaving a space between each element). Then just set the background of your larger view as an image of a bookcase. Sorry I don't know of a better way.
And for the above solution I would use a UIScrollView.
You can implement it anyway you like, but it seems to me that a UITableView would be the easiest (which will scroll anyway). All of the magic will happen in your UITableViewDataSource, which is where you will decide what books are placed on what row.
Once you have decided which books to display you will have create a custom tableview cell that draws the appropriate objects.
To be honest, while not too difficult of a task, it will take a lot of effort to get looking right. If you are not comfortable with custom drawing then be prepared to spend time learning about the various image/graphic APIs.

Keeping backing CAGradientLayer static when UITableView scrolls

I'm trying to use a CAGradientLayer as a background for a UITableView. Everything works well until the overlaying view is scrolled, at which point then the pre-rendered background scrolls up and out of the way along with the original screen of data.
This is code that is being migrated from an iOS 3.1.3 app using a UIImage as a background to something device/resolution independent-looks great, works well, but sniffing the device type and using an alternate png isn't the sort of code that I want to ship, much less maintain.
Any suggestions as to how to do this?
Found the solution to what I was trying to solve, courtesy of Matt Gallagher:
http://cocoawithlove.com/2009/08/adding-shadow-effects-to-uitableview.html
His blog post has quite a few nice touches, including shadowing relevant cells instead of the whole table (mentioned as a performance issue in Noah's response).
You may have to make the table view transparent, and add the gradient layer to the table's superview. Keep in mind that your scrolling performance is probably going to be hideous—Core Animation will have to composite every subview of the table for every frame it displays. You may be able to slightly mitigate this by setting the cells' layers to rasterize themselves, as described here, but expect things to be pretty choppy regardless.

A way to detect CATiledLayer?

I am using CATiledLayer to display a pdf page..
But the layer do have some time to draw context.
Therefore, I try to add an background beside this layer and remove the background after CATiledLayer is successful display..
My question is Is there any ways to detect the drawing status of CATiledLayer?
Thanks for your help.
subclass your CATiledLayer and make fadeDuration of tiledlayer to 0.0
A "hacky" way of doing is to pre-calculate how much tiles will be rendered, and then count the calls to - (void)drawLayer:(CALayer*)layer inContext:(CGContextRef)context. It's a pretty insecure though and most likely only works on the initial zoom level. CATiledLayer caches its tiles and doesn't tell you what is cached and what will be redrawn.