6

In my app i want to implement an iCarousel for displaying view controllers like in the below image,i was gone through about many tutorials and links but iam not getting my requirement ,help me pleaseenter image description here

Balu
  • 8,470
  • 2
  • 24
  • 41

4 Answers4

5

It is known as coverflow in iOS. Follow this link you will get what you wanted and will come to know how to implement it.

Or you can refer this question on stack overflow too. and here is accepted answered of mine

Community
  • 1
  • 1
Janak Nirmal
  • 22,706
  • 18
  • 63
  • 99
2

You can use iCarousel for the same effect

from below link download sample code for the carousel effect. https://github.com/nicklockwood/iCarousel

There is one example in No Nib Folder.

Open it & modify following code according to your requirement

//in iCarouselExampleViewController.m

In the below method modify there code as per your need.By adding different UI on the main view you can design your required UI.

In my case I have added one image & label on that main view.

- (UIView *)carousel:(iCarousel *)carousel viewForItemAtIndex:(NSUInteger)index reusingView:(UIView *)view
{

    UILabel *label = nil;
        UIImageView *imageLogo=nil;
        UIImageView *imageBack=nil;
    //create new view if no view is available for recycling
    if (view == nil)
    {
        view = [[[UIImageView alloc] initWithImage:[UIImage imageWithContentsOfFile:[[NSBundle mainBundle] pathForResource:@"page1" ofType:@"png"]]] autorelease];
        imageBack=[[[UIImageView alloc] initWithImage:[UIImage imageWithContentsOfFile:[[NSBundle mainBundle] pathForResource:@"3" ofType:@"png"]]] autorelease];
        imageBack.frame=CGRectMake(70, 70,388, 49);
        [view addSubview:imageBack];
        label = [[UILabel alloc]initWithFrame:CGRectMake(80, 78, 380, 30)];
        label.backgroundColor=[UIColor darkGrayColor];
        label.font = [label.font fontWithSize:20];
        label.backgroundColor=[UIColor clearColor];
        [view addSubview:label];
        imageLogo=[[[UIImageView alloc] initWithImage:[UIImage imageWithContentsOfFile:[[NSBundle mainBundle] pathForResource:@"Map" ofType:@"png"]]] autorelease];
        imageLogo.frame=CGRectMake(25, 70, 50, 49);
        [view addSubview:imageLogo];

    }
    else
    {
        label = [[view subviews] lastObject];
    }


    label.text = @"Some text";  

    label.frame=CGRectMake(label.frame.origin.x, label.frame.origin.y, label.frame.size.width,label.frame.size.height);

    return view;
    }

}
svrushal
  • 1,612
  • 14
  • 25
2

iCarousel is used to display views, not view controllers.

There is no need to have an array of view controllers for what you are attempting to do - since all of your views behave the same way you can put your control logic in one view controller that manages the carousel and have any buttons in your carousel views call methods on your primary view controller, using the item index to determine which carousel item was pressed.

There are several example included with iCarousel that show how to do this, including the controls example which shows how to load individual carousel views from a nib file and bind their actions to the main view controller.

Nick Lockwood
  • 40,865
  • 11
  • 112
  • 103
1

Try iCarousel for iOS it's better way to use easy to implement more carousel effects like vertical and horizontal.below links for download and implementation tutorial.

iCarousel demo project below link:

https://github.com/nicklockwood/iCarousel

iCarousel horizontal scroll implementation tutorial below link:

http://haifa.baluyos.net/index.php?option=com_content&view=article&id=60:objective-c-image-carousel-tutorial&catid=1:programming&Itemid=5

Dinesh
  • 6,500
  • 10
  • 42
  • 77