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