如何调整iCarouselTypeLinear视图的框架以移至顶部

时间:2017-01-09 12:24:45

标签: ios objective-c icarousel

如何在linearType ICarousel中调整containerView的框架从原点查看所需的高度,但它固定在视图的中间,如图所示,因为我试图设置框架,如下面的代码所示。

- (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 个答案:

答案 0 :(得分:2)

iCarousels具有各种设置,可让您调整旋转木马的位置,3D角度和其他参数。有一个设置可让您在其视图中向上或向下移动轮播。检查文档。