1

在此处输入图像描述我的要求是以水平方式显示图像列表。当我触摸图像时,它被移到一边,下一个图像出现在前面。这样我需要并排移动图像。那么有什么方法可以滚动图像列表?或者我可以选择任何类型的动画吗?

以这种方式放置和移动图像。请建议我如何进行?

4

2 回答 2

0

我解决了这个问题。我在这个链接中找到了示例。http://code4app.net/category/scrollview

于 2013-03-04T07:47:56.747 回答
0

我已经创建了一个覆盖流的工作模块......

尝试在允许 3D 转换的图层上使用....

-(void) rotateView3D:(UIView *)myView:(CGFloat)angle
{

    CATransform3D affinAndScaleTransform;
    if (angle==30.0f||angle==-30.0f)
    {
        affinAndScaleTransform = CATransform3DMakeAffineTransform(CGAffineTransformMakeScale(0.9f, 0.9f));
    }
    else
    {
        affinAndScaleTransform = CATransform3DMakeAffineTransform(CGAffineTransformMakeScale(1.0f, 1.0f));
    }
    CALayer *layer = myView.layer;

//    layer.borderColor = [[UIColor blackColor] CGColor];
//    layer.borderWidth = 2.0f;
    CATransform3D rotationAndPerspectiveTransform = CATransform3DIdentity;

    rotationAndPerspectiveTransform.m34 = 1.0 / -500;
    rotationAndPerspectiveTransform = CATransform3DRotate(rotationAndPerspectiveTransform, angle * M_PI / 180.0f, 0.0f, 1.0f, 0.0f);
    [layer setTransform:CATransform3DConcat(rotationAndPerspectiveTransform, affinAndScaleTransform)];
}

滚动视图添加手势.......

对于左手势使用这样的一些东西........

{
    UIView * view0 = [self.view viewWithTag:-1111];
    UIView * view1 = [self.view viewWithTag:1111];
    UIView * view2 = [self.view viewWithTag:2222];
    UIView * view3 = [self.view viewWithTag:3333];
    UIView * view4 = [self.view viewWithTag:4444];

    [view4 setFrame:self.rect0];

    int preViewNo = self.leftProduct-1;
    if (preViewNo<0)preViewNo=self.productArray.count-1;

    [UIView animateWithDuration:0.4 animations:^
     {
         [view0 setFrame:self.rect1];
         [self rotateView3D:view0 : 30.0f];

         [view1 setFrame:self.rect2];
         [self rotateView3D:view1 : 0.0f];

         [view2 setFrame:self.rect3];
         [self rotateView3D:view2 : -30.0f];

         [view3 setFrame:self.rect4];
         [self rotateView3D:view4 : 0.0f];

     }];

    [self setdescriptionView:view0 :[self.productArray objectAtIndex:preViewNo]];

    [view0 setTag:1111];
    [view1 setTag:2222];
    [view2 setTag:3333];
    [view3 setTag:4444];
    [view4 setTag:-1111];

    self.currentProduct--;
    self.rightProduct--;
    self.leftProduct--;
    if (self.currentProduct < 0) self.currentProduct=self.productArray.count-1;
    if (self.rightProduct < 0) self.rightProduct=self.productArray.count-1;
    if (self.leftProduct < 0) self.leftProduct=self.productArray.count-1;


}

在正确的手势识别器上使用这样的东西.......

{
    UIView * view0 = [self.view viewWithTag:-1111];
    UIView * view1 = [self.view viewWithTag:1111];
    UIView * view2 = [self.view viewWithTag:2222];
    UIView * view3 = [self.view viewWithTag:3333];
    UIView * view4 = [self.view viewWithTag:4444];

    [view0 setFrame:self.rect4];

    int nextViewNo = self.rightProduct+1;
    if (nextViewNo>=self.productArray.count)nextViewNo=0;

    [UIView animateWithDuration:0.4 animations:^
     {
         [view4 setFrame:self.rect3];
         [self rotateView3D:view4 : -30.0f];

         [view3 setFrame:self.rect2];
         [self rotateView3D:view3 : 0.0f];

         [view2 setFrame:self.rect1];
         [self rotateView3D:view2 : 30.0f];

         [view1 setFrame:self.rect0];
         [self rotateView3D:view1 : 0.0f];

     }];

    [self setdescriptionView:view4 :[self.productArray objectAtIndex:nextViewNo]];

    [view0 setTag:4444];
    [view1 setTag:-1111];
    [view2 setTag:1111];
    [view3 setTag:2222];
    [view4 setTag:3333];

    self.currentProduct++;
    self.rightProduct++;
    self.leftProduct++;
    if (self.currentProduct >= self.productArray.count) self.currentProduct=0;
    if (self.rightProduct >= self.productArray.count) self.rightProduct=0;
    if (self.leftProduct >= self.productArray.count) self.leftProduct=0;
}

由于某些技术原因,我必须制作自定义封面流......

你也可以试试这个.....

发情的

于 2013-03-04T10:55:17.527 回答