本文介绍了如何在ios6.1中显示表视图列表作为封面流程的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是iOS编程的新手。我找到了将图像视图显示为封面流程的教程,如链接

I am new to iOS programming.I find the tutorial for displaying the image view as cover flow as shown in link http://code4app.net/ios/iCarousel-for-Cover-Flow/4f87d2db06f6e79d32000000

但我的要求是显示tableviews列表作为封面流程。请帮助我。

but my requirement is to display the list of tableviews as cover flow. Please help me.

推荐答案

这里我使用了iCarousel视图。将SDK(导入iCarousel.h和iCarousel.m)集成到您的应用程序中之后。在所有icarousel子视图中创建ICarousel视图和集成表视图。这是我的代码

Here i have used iCarousel view. After integrating the SDK(import iCarousel.h & iCarousel.m) into your application. Create ICarousel view and integrated table view in all the icarousel sub views. Here is my code

在.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;

    }

其工作正常输出就像这样...

Its working fine Output is like this...

这篇关于如何在ios6.1中显示表视图列表作为封面流程的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-22 12:06