문제

I'm animating a small view with popup effect to alert you of an error ... The animation works perfectly but still are not very satisfied because I would like the view does not stop at position (x 25) but I wish they came to ( x 40 ) and then return immediately to ( x 25). In other words I would like to recreate the effect they have on the textfield MontainLion when you are wrong to insert the fields User for access to the operating system ...

I really hope to be able to explain to me , but if I did not succeed please comunicarmelo so that I can explain it better to resolve this question. Thanks to all! Rory .

Below I show you the code to display the pop-up I'm using

- (Void)presentazioneViewTransition
{
    CGRect endREct ;
    endREct = CGRectMake (25, 160, 270, 90);
    [UIView beginAnimations:nil context:nil];
    [UIView setAnimationDuration:0.25];
    [UIView setAnimationDelegate:self];
    [UIView setAnimationDidStopSelector:@selector(endRightAnimation)];

    self.frame = endREct;
    [UIView commitAnimations];
}
도움이 되었습니까?

해결책

You can use the simple block based UIView animation methods like this

-(void)presentazioneViewTransition{
    CGRect transitionRect = CGRectMake(40.0f, 160.0f, 270.0f, 90.0f);
    CGRect endREct = CGRectMake (25.0f, 160.0f, 270.0f, 90.0f) ;
    [UIView animateWithDuration:0.15f
                     animations:^{
                         self.frame = transitionRect;
                     }
                     completion:^(BOOL finished) {
                         [UIView animateWithDuration:0.1f
                                          animations:^{
                                              self.frame = endREct;
                                          }];
                     }];
}
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top