iOS: Wie Entferne Objekt aus dem Speicher mit ARC aktiviert?

Ich bin der Entwicklung einer iOS-app mit der iOS-5-SDK, die Automatische Referenz-Zählung aktiviert ist. Aber ich habe ein bestimmtes Objekt in großer Anzahl erstellt und freigegeben werden, müssen nach einem zweiten, da sonst das Gerät wird sehr langsam. Es sieht aus wie Sie werden nicht freigegeben, da das Gerät ist sehr langsam. Gibt es eine Möglichkeit, manuell ein Objekt freigeben, wenn ARC aktiviert ist?

EDIT: Mein code, das heißt 200 mal in der Sekunde zu generieren funkelt. Sie verblassen nach 0,8 Sekunden, so dass Sie nutzlos sind, dann.

    int xanimationdiff = arc4random() % 30;
    int yanimationdiff = arc4random() % 30;
    if (arc4random()%2 == 0) {
        xanimationdiff = xanimationdiff * -1;
    }
    if (arc4random()%2 == 0) {
        yanimationdiff = yanimationdiff * -1;
    }

    Sparkle *newSparkle = [[Sparkle alloc] initWithFrame:CGRectMake(20 + arc4random() % 280, 20, 10, 10)];
    //[newSparkle setTransform:CGAffineTransformMakeRotation(arc4random() * (M_PI * 360 /180))]; //Rotatie instellen (was niet mooi, net sneeuw)
    [self.view addSubview:newSparkle];
    [UIView beginAnimations:nil context:NULL];
    [UIView setAnimationDuration:0.8];
    [newSparkle setFrame:CGRectMake(newSparkle.frame.origin.x - xanimationdiff, newSparkle.frame.origin.y - yanimationdiff, newSparkle.frame.size.width, newSparkle.frame.size.height)];
    newSparkle.alpha = 0;
    [UIView commitAnimations];

Funkeln Objekt-code:

#import "Sparkle.h"

@implementation Sparkle

- (id)initWithFrame:(CGRect)frame
{
    self = [super initWithFrame:frame];
    if (self) {
        [self setBackgroundColor:[UIColor colorWithPatternImage:[UIImage imageNamed:@"sparkle.png"]]];
    }
    return self;
}

@end

InformationsquelleAutor icant | 2011-10-03

Schreibe einen Kommentar