apple beginner here. Im currently studying and trying the iCarousel by nickLockwood. Im planning on putting images in the iCarousel. So here's my .m and .h code:
// .m
@implementation ViewController
@synthesize images;
...
- (void)awakeFromNib
{
if (self) {
//set up carousel data
//wrap YES = infinite loop
wrap = YES;
self.images = [NSMutableArray arrayWithObjects:
@"apple.jpg",@"lemon.jpg",@"orange.jpg",@"melon.jpg",@"mango.jpg",nil];
}
}
- (UIView *)carousel:(iCarousel *)_carousel viewForItemAtIndex:(NSUInteger)index reusingView:(UIView *)view
{
if (view == nil)
{
view = [[UIImageView alloc] initWithImage:[UIImage imageNamed:[images objectAtIndex:index]]];
}
return view;
}
// .h
@interface ViewController : UIViewController <iCarouselDataSource, iCarouselDelegate>{
NSMutableArray *images;
...
}
@property (nonatomic,retain) NSMutableArray *images;
…
@end
I was planning on adding 30 images so I want the code to be maintainable. My problem is I want to be able to get the image by NSBundle or from the applications directory, I've tried different codes but the image doesn't appear in the carousel. Thanks for your help.