アプリにカルーセル タイプ ピッカーを実装するために iCarousel ライブラリを使用しようとしていますが、カルーセルを表示するビューを読み込んでも、何も表示されません。
関連するコードは次のとおりです。
iCarousel デリゲート メソッド:
- (NSUInteger)numberOfItemsInCarousel:(iCarousel *)carousel {
return 65;
}
- (UIView *)carousel:(iCarousel *)carousel viewForItemAtIndex:(NSUInteger)index reusingView:(UIView *)view {
// Create a number label representing a numeric WPM option
UILabel *numberLabel = nil;
// Create new view if no view is available for recycling
if (!view) {
view = [[UIImageView alloc] initWithFrame:CGRectMake(10, 10, 220, 60)];
numberLabel = [[UILabel alloc] initWithFrame:view.bounds];
numberLabel.backgroundColor = [UIColor clearColor];
numberLabel.textColor = [UIColor whiteColor];
numberLabel.textAlignment = NSTextAlignmentCenter;
numberLabel.tag = 1;
[view addSubview:numberLabel];
}
else {
numberLabel = (UILabel *)[view viewWithTag:1];
}
// Calculate the number's value depending on the index value being retrieved
int number = 200 + (index * 20);
numberLabel.text = [@(number) stringValue];
return view;
}
そしてでviewDidLoad:
:
self.carousel = [[iCarousel alloc] initWithFrame:CGRectMake(120, 35, 150, 50)];
self.carousel.type = iCarouselTypeLinear;
[self.view addSubview:self.carousel];
それを台無しにしている正確に何が欠けていますか?