0

I'm fairly new to iOS development and I'm currently working on my thesis about this topic. My assignment is to build an app for a movie theater. The design has a horizontal slider containing the latest movie posters with the title, and I'm wondering how I should approach this design.

Screenshot http://cl.ly/2S1b381S2v1x2y0U1q2H

There is an array with the movie poster image and the title, and I wan't them to show like the screenshot and being able to scroll horizontally between them.

I've looked around but I'm getting very confused by different approaches that are not 100% the same as my problem.

The nav bar and tab bar are just placeholders, I know how to implement those.

I'm hoping someone can help me with getting started with this design, how I should approach this.

Thanks in advance,

Lars

2 Answers2

2

You can download and use the demo application at the following url as reference

https://developer.apple.com/library/ios/#samplecode/Scrolling/Introduction/Intro.html

By increasing the size of the UIScrollView will be showing part the contents towards left and right.

In the demo there are showing images, instead of that create a UIView which hold image and title and replace should work.

- (void)loadScrollViewWithPage:(int)page scrollingView:(UIScrollView*)scrollView
{
//NSLog(@"page %d",page);

if (page < 0) return;
if (page >= numberOfPages) return;

// replace the placeholder if necessary
IconsViewController *controller;

if (scrollView == iconsScrollView)
{
    controller = [viewControllers objectAtIndex:page];
}

if ((NSNull *)controller == [NSNull null]) 
{
    controller = [[IconsViewController alloc] init];
    controller.pageIndex = page;
    if (scrollView == iconsScrollView)
    {
        [viewControllers replaceObjectAtIndex:page withObject:controller];
    }
    [controller release];
}

// add the controller's view to the scroll view
if (nil == controller.view.superview) 
{
    CGRect frame = scrollView.frame;
    frame.origin.x = frame.size.width * page;
    frame.origin.y = 0;
    controller.view.frame = frame;
    [scrollView addSubview:controller.view];
}
}
Hanuman
  • 642
  • 5
  • 19
  • I got the demo working in my own project now, but can you explain to me how to start with adding the title to the scrollView aswel I can't seem to figure it out. – Lars Swemmer Mar 13 '12 at 16:10
  • IconsViewController is the view controller which will have the image and title placed on it. – Hanuman Mar 14 '12 at 10:56
  • also you can view the example @ http://fromideatoapp.com/downloads/UIScrollView_Example.zip – Hanuman Mar 14 '12 at 10:58
  • I've got everything working, the next step I wanna make is when you tap a view, that it will segue to a more informatie page. So for example I got 6 movie posters and I tab on 1 movie poster, I get more informatie about that movie. Can you help me with this? – Lars Swemmer Apr 03 '12 at 12:46
  • Hi Lars,i am also working on the same type of view. This is to show the issues. Can u please tell me how to show the view at the centre when i am scrolling the pages...Hope u help me in this – ask123 Aug 30 '12 at 15:42
0

You should use a UIScrollView with paging enabled. And then take a look at this approach: https://stackoverflow.com/a/3018776/696440

Community
  • 1
  • 1
basvk
  • 4,437
  • 3
  • 29
  • 49