私は iOS プログラミングが初めてです。リンクhttp://code4app.net/ios/iCarousel-for-Cover-Flow/4f87d2db06f6e79d32000000に示すように、画像ビューをカバー フローとして表示するためのチュートリアルを見つけました。
しかし、私の要件は、テーブルビューのリストをカバー フローとして表示することです。私を助けてください。
私は iOS プログラミングが初めてです。リンクhttp://code4app.net/ios/iCarousel-for-Cover-Flow/4f87d2db06f6e79d32000000に示すように、画像ビューをカバー フローとして表示するためのチュートリアルを見つけました。
しかし、私の要件は、テーブルビューのリストをカバー フローとして表示することです。私を助けてください。
ここでは iCarousel ビューを使用しました。SDK(import iCarousel.h & iCarousel.m) をアプリケーションに統合した後。すべての icarousel サブビューで、ICaroosel ビューと統合テーブル ビューを作成します。これが私のコードです
.h ファイル内
iCarousel *categorySubView;
.M ファイル内。
-(Void)createIcarousel{
categorySubView = [[iCarousel alloc]initWithFrame:CGRectMake(10, 108, 480, 125)];
// categorySubView.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight;
categorySubView.delegate = self;
categorySubView.dataSource = self;
categorySubView.type=iCarouselTypeCoverFlow2;
[self.view addSubview:categorySubView];
}
-(NSUInteger)numberOfItemsInCarousel:(iCarousel *)carousel
{
return 10;
}
- (UIView *) carousel:(iCarousel *)carousel viewForItemAtIndex:(NSUInteger)index reusingView:(UIView *)view{
UITableView *sampleTable = [[UITableView alloc] initWithFrame:CGRectMake(0, 0, 150, 150) style:UITableViewStylePlain];
sampleTable.dataSource = self;
sampleTable.delegate = self;
[sampleTable setBackgroundColor:[UIColor blackColor]];
return sampleTable;
}
- (BOOL)carousel:(iCarousel *)carousel shouldSelectItemAtIndex:(NSInteger)index{
return YES;
}
- (CGFloat)carouselItemWidth:(iCarousel *)carousel
{
//usually this should be slightly wider than the item views
return 180;
}
#pragma Table view delegate Methods
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView {
return 1;
}
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
return 10;
}
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
static NSString *CellIdentifier = @"Cell";
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
if (cell == nil) {
cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier] autorelease];
}
// Configure the cell...
// cell.textLabel.text = [yourarray objectAtIndex:indexPath.row];
return cell;
}
その正常に動作する出力は次のようになります...