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;
}