apple starter is here. Im currently studying and trying iCarousel by nickLockwood. I plan to post images to iCarousel. So here is my .m and .h code:
//.m
@implementation ViewController
@synthesize images;
...
- (void)awakeFromNib
{
if (self) {
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 planned to add 30 images, so I want the code to be supported. My problem is that I want to get an NSBundle image or from the application directory, I tried different codes, but the image does not appear in the carousel. Thank you for your help.
source
share