apple初心者はここに。私は現在、nickLockwoodによってiCarouselを勉強して試しています。私はiCarouselに画像を置くことを計画しています。だからここに私の.mと.hのコードです:iCarouselの読み込みに問題がある
// .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
私はコードになりたいので、私は30枚の画像を追加することを計画しました。維持可能。 私の問題は、NSBundleまたはアプリケーションディレクトリからイメージを取得したいのですが、私は別のコードを試しましたが、イメージがカルーセルに表示されません。ご協力いただきありがとうございます。
デリゲートとデータソースを設定しましたか?それは私が見たように良いです – adali
はい私はすでにそれを設定しました。 – Bazinga
あなたの問題は何ですか、ビューが表示されない、または空のビューのみですか? – adali