如何在按钮单击上执行幻灯片视图

时间:2013-12-31 07:17:39

标签: ios

在我的主视图控制器中,按钮操作是

-(IBAction)ChangeImage
        {

        UIImage *guns = [UIImage imageNamed:@"guns.png"]; // load our image resource
        imageView = [[UIImageView alloc] initWithImage:guns];

            NSLog(@"kaam hua..??");
            [self.view addSubview:imageView];

            [UIView transitionFromView:self.view
                                toView:imageView
                              duration:3.0f

             options:UIViewAnimationOptionTransitionCrossDissolve
                            completion:nil];

                                NSLog(@"hfhjlkhbjhdfcvkbjnlkhgj");
     }
  1. 我想在幻灯片视图中查看动画
  2. 有什么方法可以做到这一点
  3. 我可以将UIViewAnimationOptionTransitionCrossDissolve更改为另一个以显示幻灯片视图

1 个答案:

答案 0 :(得分:0)

您可以在动画选项中使用 UIViewAnimationOptionCurveEaseIn

试试这个,

CGRect or=self.view.frame;

CGRect basketTopFrame = self.view.frame;
basketTopFrame.origin.x =  basketTopFrame.size.width;

self.view.frame = basketTopFrame;

[UIView animateWithDuration:0.2
                      delay:0.0
                    options: UIViewAnimationOptionCurveEaseIn
                 animations:^{

                          [self.view addSubview:imageView];

                 }
                 completion:^(BOOL finished){
                     NSLog(@"Done!");
                 }];