我想为我创建的幻灯片放映的每个图像添加过渡效果,以便我将如何添加?

时间:2011-08-16 06:55:42

标签: iphone

这里有一些与我的幻灯片相关的代码,我想要的是在每个img上添加过渡效果.Img将从库中选取并在该img上添加过渡效果,这样当我们播放幻灯片时,具有特定过渡的图像应该播放意味着当1个过渡将与他们的反转消失。效果另一个将出现其过渡效应..

   - (void)addPhoto
{
if (imagePicker == nil) 
{

  imagePicker = [[UIImagePickerController alloc] init];
  imagePicker.allowsImageEditing = YES; 

  imagePicker.sourceType =
     UIImagePickerControllerSourceTypePhotoLibrary;
  imagePicker.delegate = self; 
}

returnFromImagePicker = YES; 


[self presentModalViewController:imagePicker animated:YES];
} 


- (void)imagePickerController:(UIImagePickerController *)picker
didFinishPickingImage:(UIImage *)img editingInfo:
(NSDictionary *)editInfo
{
[pictures addObject:img]; 

 UITableView *table = (UITableView *)self.view;


  [table insertRowsAtIndexPaths:[NSArray arrayWithObject:[NSIndexPath
  indexPathForRow:pictures.count - 1 inSection:0]] withRowAnimation:
  UITableViewRowAnimationRight];


[self dismissModalViewControllerAnimated:YES];
 } 


- (void)addEffect
{
if (effectSheet == nil) 
{

  effectSheet = [[UIActionSheet alloc] initWithTitle:@"Choose Effect"
     delegate:self cancelButtonTitle:nil destructiveButtonTitle:nil
     otherButtonTitles:@"Fade", @"Slide In", nil];
} 

[effectSheet showInView:self.view];
} 


- (void)actionSheet:(UIActionSheet *)actionSheet clickedButtonAtIndex:
 (NSInteger)buttonIndex
{   
effect = buttonIndex;

}

1 个答案:

答案 0 :(得分:0)

UIView有一个类方法,通过该方法可以通过转换从一个视图转换到另一个视图。像这样使用它:

[UIView transitionFromView:currentView toView:newView duration:1.0 options:UIViewAnimationOptionTransitionFlipFromLeft completion:nil];

有关更多信息,请参阅Apple's UIView documentation