0
在我的应用程序中,我有一个修复大小的按钮/中心点,我想旋转箭头线和此附加图像也旋转时,我触摸/向上/向下滚动。 而我在这个作了一个演示,我只使用icarousel类来滚动图像。 但我无法同时滚动两个箭头和图像滚动。 请帮助我如何实现这一点。 如何从固定的中心点旋转图像和箭头线
,并使用icarousel在这里我只图像滚动代码..
- (UIView *)carousel:(__unused iCarousel *)carousel viewForItemAtIndex: (NSInteger)index reusingView:(UIView *)view
{
UIView *viewFor;
UIImageView *itemView;
if (view==nil) {
viewFor=[[UIView alloc]initWithFrame:CGRectMake(0, 0, 200, 200)];
itemView=[[UIImageView alloc]initWithFrame:CGRectMake(0, 45, 120, 120)];
[itemView.layer setCornerRadius:itemView.frame.size.width/2];
[itemView setClipsToBounds:YES];
[viewFor addSubview:itemView];
StikImage=[[UIImageView alloc]initWithFrame:CGRectMake(-140, 95, 140, 20)];
StikImage.backgroundColor=[UIColor whiteColor];
[viewFor addSubview:StikImage];
}
else
{
viewFor=[[UIView alloc]initWithFrame:CGRectMake(0, 0, 200, 200)];
itemView=[[UIImageView alloc]initWithFrame:CGRectMake(0, 45, 120, 120)];
[itemView.layer setCornerRadius:itemView.frame.size.width/2];
[itemView setClipsToBounds:YES];
[viewFor addSubview:itemView];
StikImage=[[UIImageView alloc]initWithFrame:CGRectMake(-140, 95, 140, 20)];
StikImage.backgroundColor=[UIColor whiteColor];
[viewFor addSubview:StikImage];
}
itemView.image=[images objectAtIndex:index];
return viewFor;
}
这里是我的自定义类型icrousel方法变换图像
- (CATransform3D)carousel:(iCarousel *)carousel itemTransformForOffset:(CGFloat)offset baseTransform:(CATransform3D)transform {
const CGFloat centerItemZoom = 1.6;
const CGFloat centerItemSpacing = 1.2;
const CGFloat centerItemYOffset = 100;
CGFloat spacing = [self carousel:carousel valueForOption:iCarouselOptionSpacing withDefault:1.3f];
CGFloat absClampedOffset = MIN(2.5, fabs(offset));
CGFloat clampedOffset = MIN(1.0, MAX(-1.0, offset));
CGFloat scaleFactor = 1.0 + absClampedOffset * (1.2/centerItemZoom - 1.0);
CGFloat yoffset = (1.0f - absClampedOffset) * centerItemYOffset;
offset = (scaleFactor * offset + scaleFactor * (centerItemSpacing - 1.0) * clampedOffset) * carousel.itemWidth * spacing;
if (carousel.vertical)
{
transform = CATransform3DTranslate(transform, yoffset, offset, -absClampedOffset);
}
else
{
transform = CATransform3DTranslate(transform, offset, yoffset, -absClampedOffset);
}
transform = CATransform3DScale(transform, scaleFactor, scaleFactor, 5.0f);
return transform;
}
首先感谢回答@iSara,但我如何设置y偏移量和度数来上下滚动/关于图像的线条/线条。 – RAMA
@RAMA:你可以在scrollview委托方法中使用上面的代码吗? – iSara
..我不能...即时通讯使用iCarousel视图在我的代码完成这种类型完美的图像,但现在我想添加这些箭头/线附加图像..这些箭头也旋转时间与图像在相同角度我怎么能做到这一点..请帮助我.. – RAMA