2011-07-07 6 views
0

Je veux apporter une vue à mon contrôleur de vue avec un peu d'animation. quelque chose comme l'application Facebook.uiview avec animation

i utiliser ce code pour amener le UIView à l'écran et je veux savoir comment je peux le faire avec peu d'animation:

self.tmpView = [[UIView alloc] initWithFrame:CGRectMake(20, 20, 280, 330)]; 
self.tmpView.backgroundColor = [UIColor yellowColor]; 
UIImage *tmpImg = [UIImage imageNamed:@"d.png"]; 
UIImageView *tmpImgView = [[UIImageView alloc] initWithFrame:CGRectMake(10, 10, 100, 100)]; 
tmpImgView.image = tmpImg; 


UIButton *returnBTN = [[UIButton buttonWithType:UIButtonTypeRoundedRect] retain]; 
returnBTN.frame = CGRectMake(10, 110, 100, 25); 
returnBTN.backgroundColor = [UIColor clearColor]; 
[returnBTN setTitle:@"חזור" forState:UIControlStateNormal]; 
[returnBTN addTarget:self action:@selector(backPressed) forControlEvents:UIControlEventTouchUpInside]; 


UIButton *orderBTN = [[UIButton buttonWithType:UIButtonTypeRoundedRect] retain]; 
[orderBTN setTag:tag]; 
orderBTN.frame = CGRectMake(130, 110, 100, 25); 
orderBTN.backgroundColor = [UIColor clearColor]; 
[orderBTN setTitle:@"הזמן" forState:UIControlStateNormal]; 
[orderBTN addTarget:self action:@selector(orderPressed:) forControlEvents:UIControlEventTouchUpInside]; 



[self.tmpView addSubview:tmpImgView]; 
[self.tmpView addSubview:returnBTN]; 
[self.tmpView addSubview:orderBTN]; 


[self.view addSubview:self.tmpView]; 

Répondre

1
[UIView transitionFromView:viewToMoveOut toView:viewToMoveIn duration:timeOfDuration options:(option1 | option2 | ...) completion:^(BOOL finished){ 
    if (finished){ 
     // code when animation finished. 
    } 
}];