iCarousel icon indicating copy to clipboard operation
iCarousel copied to clipboard

iCarouse dynamic label width

Open RaghavaNaidu46 opened this issue 8 years ago • 1 comments

screen shot 2017-01-17 at 1 45 08 pm Need to display items with dynamic widths. i have tried bellow code. but its increasing spaces between items too. here is my code:

  • (UIView *)carousel:(iCarousel *)carousel viewForItemAtIndex:(NSInteger)index reusingView:(UIView *)view {

    UILabel *label = [[UILabel alloc]init]; label.font = [UIFont systemFontOfSize:13]; label.text = [timelineMediaArray objectAtIndex:index]; label.textAlignment = NSTextAlignmentCenter;

    CGFloat width = [label.text sizeWithAttributes:@{NSFontAttributeName:[UIFont systemFontOfSize:13 ]}].width; label.frame = CGRectMake(0, 0, width+20,30); label.backgroundColor = [UIColor redColor]; label.textColor = [UIColor whiteColor];

    return label;

}

RaghavaNaidu46 avatar Jan 17 '17 09:01 RaghavaNaidu46

Hi, did you find a solution plase?

dhekrazaied avatar Jun 30 '18 20:06 dhekrazaied