【问题标题】:How to adjust the frame for iCarouselTypeLinear view to move to top如何调整 iCarousel 类型线性视图的框架以移动到顶部
【发布时间】:2017-01-09 12:24:45
【问题描述】:

如何将linearType ICarousel View中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;  
}  

.

【问题讨论】:

    标签: ios objective-c icarousel


    【解决方案1】:

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

    【讨论】:

    • 你能不能给它命名(设置名称),我试过了,但我没有找到任何东西。
    • 我已经一年多没有使用 iCarousel 了,我得像你一样去寻找文档。 iCarousel 附带了一个演示应用程序,该应用程序具有滑块,可让您在其封闭视图上移动轮播。看看那个应用程序。
    • 属性好像是contentOffset
    • 谢谢@Duncan,我将内容偏移的高度设置为我需要的高度,它起作用了。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2016-11-30
    相关资源
    最近更新 更多