I am using Nick Lockwood's iCarousel class to display a series of images stored in an array using the method
- (UIView *)carousel:(iCarousel *)carousel viewForItemAtIndex:(NSInteger)index reusingView:(UIView *)view
{
//create new view if no view is available for recycling
if (view == nil)
{
view = [[UIImageView alloc] initWithFrame:CGRectMake(0, 0, 100.0f, 100.0f)];
((UIImageView *)view).image = [images objectAtIndex:index];
view.contentMode = UIViewContentModeScaleAspectFit;
}
}
I would now like to display text stored in a similar array below(and centered) each image much like movie titles are placed under thumbnails in the imDB app. Any help would be immensely appreciated. Thanks in advance!
You can add UILabel
to view
i.e,
- (UIView *)carousel:(iCarousel *)carousel viewForItemAtIndex:(NSInteger)index reusingView:(UIView *)view
{
//create new view if no view is available for recycling
if (view == nil)
{
view = [[UIImageView alloc] initWithFrame:CGRectMake(0, 0, 100.0f, 100.0f)];
((UIImageView *)view).image = [images objectAtIndex:index];
view.contentMode = UIViewContentModeScaleAspectFit;
UILabel *lbl = [[UILabel alloc] initWithFrame:CGRectMake(0, 70, 100.0f, 30.0f)];
lbl.text = [titlesArray objectAtIndex:index]; // Here you can add titles to label
/* Here you can code the EFX. */
[view addSubview:lbl];
}
}