2009-06-10 21 views

Antwort

-2

Sie haben nur die Wahl, den Mechanismus des Renderns des Gifs in einer Ansicht zu programmieren oder darauf zu warten, dass Apple es repariert.

2

In iPhone OS 3.0 wird cell.image nicht mehr unterstützt. Stattdessen haben Zellen eine imageView-Eigenschaft, die Ihnen mehr Flexibilität bietet. Sie können die animierte GIF in einzelne Bilder aufgeteilt, und dann wie folgt vorgehen:

anImageView *UIImageView = [[UIImageView alloc] init]; 
anImageView.animationImages = imagesArray; //this is an array of UIImages you have to create 
15

UIImageView die notwendigen APIs bietet Ihre eigenen Animationen wie diese zu produzieren:

UIImage *frame1 = [UIImage imageNamed:@"frame1.png"]; 
UIImage *frame2 = [UIImage imageNamed:@"frame2.png"]; 
UIImage *frame3 = [UIImage imageNamed:@"frame3.png"]; 
UIImage *frame4 = [UIImage imageNamed:@"frame4.png"]; 


UIImageView.animationImages = [[NSArray alloc] initWithObjects:frame1, frame2, frame3, frame4, nil]; 
UIImageView.animationDuration = 1.0 //defaults is number of animation images * 1/30th of a second 
UIImageView.animationRepeatCount = 5; //default is 0, which repeats indefinitely 
[UIImageView startAnimating]; 

//[uiImageView stopAnimating]; 
+0

Dies ist eine hilfreiche Antwort, aber die genauere Code sollte sagen: 'UIImageView * animatedImageView; animatedImageView.AnimationImages = ...; animatedImageView.AnimationDuration = ...; ...; ' – Neeku

1

Nur UIWebView unterstützt eine animierte angezeigt werden GIF-Datei.

1

Können Sie bitte sehen Sie den folgenden Code, den ich hoffe, dass es für Sie hilfreich sein ...

1. in die Animation Code entfernen cellforatindexpath

2. belebtes es, wenn die Zelle Anzeige wird

3. Stop-Animation, während die Zellen versteckt

4. Wird die Leistung der App verbessern

5. Speichern mehr Speicher

-(void)tableView:(UITableView *)tableView willDisplayCell:(UITableViewCell *)cell forRowAtIndexPath:(NSIndexPath *)indexPath{ 
    NSArray *myImageArray = [NSArray arrayWithObjects: 
          [UIImage imageNamed:@"image1.png"], 
          [UIImage imageNamed:@"image2.png"], 
          [UIImage imageNamed:@"image3.png"], 
          [UIImage imageNamed:@"image4.png"], 
          [UIImage imageNamed:@"image5.png"],nil]; 

    [cell.imageView setAnimationImages:myImageArray]; 
    cell.imageView.animationDuration = 4.0; 
    cell.imageView.animationRepeatCount = 1; 
    [cell.imageView startAnimating]; 
    } 

    -(void)tableView:(UITableView *)tableView didEndDisplayingCell:(UITableViewCell *)cell forRowAtIndexPath:(NSIndexPath *)indexPath{ 
    [cell.imageView stopAnimating]; 
    [cell.layer removeAllAnimations]; 
    } 
Verwandte Themen