2017-01-09 96 views
0

如何在linearType ICarousel視圖中調整containerView的框架從原點到所需的高度,但它固定在視圖中間,如圖中所示,如我試圖設置框架,如下面的代碼所示。如何調整iCarouselTypeLinear視圖的框架以移動到頂部

- (UIView *)carousel:(__unused iCarousel *)carousel viewForItemAtIndex:(NSInteger)index reusingView:(UIView *)view {  
UILabel *label = nil; 
//create new view if no view is available for recycling 
// if (view == nil) 
// { 
    view = [[UIImageView alloc] initWithFrame:CGRectMake(0, 0, [UIObjects widthOfTheElement:267], [UIObjects heightOfTheElement:172])]; 
    ((UIImageView *)view).image = [UIImage imageNamed:[self.imagesArray objectAtIndex:index]]; 
//  view.contentMode = UIViewContentModeCenter; 
//  view.backgroundColor=[UIColor yellowColor]; 
    label = [[UILabel alloc] initWithFrame:view.bounds]; 
    label.backgroundColor = [UIColor clearColor]; 
    label.textAlignment = NSTextAlignmentCenter; 
    label.font = [label.font fontWithSize:50]; 
    label.tag = 1; 
    [view addSubview:label]; 
if (index==0) 
{ 
    label.text = @"ramki";  
} 
else 
{ 
} 
return view; 
} 

Pleae click here to view image

回答

1

iCarousels具有各種設置,可讓您調整旋轉木馬的位置,3D角度和其他參數。有一種設置可以讓您在視圖中上下移動轉盤。檢查文檔。

+0

你可以給它命名(設置名稱),我試過但我沒有找到任何東西。 –

+0

一年多來我還沒有使用iCarousel,並且不得不像你一樣尋找文檔。有一個與iCarousel一起提供的演示應用程序,該應用程序具有滑塊,可讓您將傳送帶移動到封閉視圖上。看看那個應用程序。 –

+0

看起來像屬性是'contentOffset' –