Erstellen einer Pop-Animation ähnlich der Präsentation von UIAlertView

Möchte ich eine Ansicht in der gleichen Weise wie der uialertview-Objekt - pop/Frühjahr. Leider Unterklassen uialertview-Objekt ist nicht eine option für die Ansicht, die ich präsentieren muss. Ich habe geschrieben einige Codes, aber ich kann nicht scheinen, um es so realistisch wie ich es gerne hätte. Ich würde schätzen, Anregungen für mehr Realismus oder einen link, wenn etwas ähnliches getan hat (ich konnte nichts finden auf Google). Danke.

  - (id)initWithFrame:(CGRect)frame {
    if ((self = [super initWithFrame:frame])) {

        self.backgroundColor = [UIColor whiteColor];

        v = [[UIView alloc] initWithFrame:CGRectMake(140, 140, 60, 60)];
        v.backgroundColor = [UIColor blueColor];

        [self addSubview:v];
        [self animate];

    }
    return self;
}

- (void)animate {

    [UIView beginAnimations:nil context:NULL];
    [UIView setAnimationCurve:UIViewAnimationCurveLinear];
    [UIView setAnimationDuration:0.2];
    [UIView setAnimationDelegate:self];
    [UIView setAnimationDidStopSelector:@selector(popStep1Complete)];
    v.frame = CGRectMake(90, 90, 140, 140);
    [UIView commitAnimations];
}

- (void)popStep1Complete {

    [UIView beginAnimations:nil context:NULL];
    [UIView setAnimationCurve:UIViewAnimationCurveLinear];
    [UIView setAnimationDuration:0.15];
    [UIView setAnimationDelegate:self];
    [UIView setAnimationDidStopSelector:@selector(popStep2Complete)];
    v.frame = CGRectMake(110, 110, 100, 100);
    [UIView commitAnimations];
}

- (void)popStep2Complete {

    [UIView beginAnimations:nil context:NULL];
    [UIView setAnimationCurve:UIViewAnimationCurveLinear];
    [UIView setAnimationDuration:0.15];
    v.frame = CGRectMake(100, 100, 120, 120);
    [UIView commitAnimations];
}

InformationsquelleAutor der Frage RunLoop | 2010-04-22

Schreibe einen Kommentar