|
|||
|
Add this line to the end and you can save the image to your photo library -
UIImageWriteToSavedPhotosAlbum(viewImage, self, nil, nil); or if you need a callback: UIImageWriteToSavedPhotosAlbum(viewImage, self, (SEL)@selector(viewImage:didFinishSavingWithError: contextInfo:), nil); - (void)image:(UIImage *)image didFinishSavingWithError:(NSError *)error contextInfo:(void *)contextInfo; |
|
||||
|
WOW, this is sick, exactly what I needed!
I had a rotating UITable with lots of rows at 20px height each.. and the rotate effect was painfully slow.. I wonder how Safari managed to do such smooth rotation even on the most overloaded websites, I guess this is the method it uses ? big thanks, will try it when I get home. |
|
||||
|
Quote:
|
|
|||
|
well, if you do cache.. it generates a static image and then rotates that... if not, it renders for each frame... right? so, was it slow without using cache or with? If that description above is accurate -- all rotations should be the same speed.
|
|
|||
|
Hi,
When I found this code, I thought "cool that's all I need" but visibly not. I have a UIImageView which is an animation: Code:
UIImageView *myImage=[[UIImageView alloc] InitWithFrame:CGRectMake(0.0, 0.0, 100.0, 100.0)];
myImage.imageView.animationImages= [NSArray arrayWithObjects:[UIImage imageNamed:@"foo1.png"],
[UIImage imageNamed:@"foo2.png"],nil];
imageView.animationDuration=0.7;
imageView.animationRepeatCount=0;
[myImage startAnimating];
So I tryed with the previous sample...: Code:
UIGraphicsBeginImageContext(myImage.bounds.size); [myImage.layer renderInContext:UIGraphicsGetCurrentContext()]; UIImage *snapshot = UIGraphicsGetImageFromCurrentImageContext(); UIGraphicsEndImageContext(); So I've tested this code on another UIImageView like this: Code:
UIImageView *myImage=[[UIImageView alloc] InitWithFrame:CGRectMake(0.0, 0.0, 100.0, 100.0)];
myImage.imageView.animationImages= [NSArray arrayWithObjects:[UIImage imageNamed:@"foo1.png"],
[UIImage imageNamed:@"foo2.png"],nil];
myImage.image=[UIImage imageNamed:@"foo3.png"]
imageView.animationDuration=0.7;
imageView.animationRepeatCount=0;
[myImage startAnimating];
So have you got any idea how can I get the current image played? I tried also with a timer which would indicate me time elapsed since the beginning of the animation but it's a bad solution and it doesn't work too. Thanks for your replies. |
![]() |
| Thread Tools | |
| Display Modes | |
|
|