carousel in iPhone

Discussion in 'iOS Programming' started by m1anoj, Oct 15, 2009.

  1. macrumors newbie

    Joined:
    Oct 15, 2009
    #1
    Hi,
    currently am developing an multimedia application where i need to create some sort of carousel at the bottom of the iPhone screen.:confused::confused:
    I tried with UISegmentedControl, but with that i cant able to slide/scroll the segmented control. The requirement s like the carousel should come @ the bottom of the screen where it can slide with user's touch/scroll, n each item in the carousel should pop up with a new screen when the item gets focus.
    need some urgent solution guys....
     
  2. Moderator

    dejo

    Staff Member

    Joined:
    Sep 2, 2004
    Location:
    The Centennial State
    #2
    You can if you put the UISegmentedControl inside (as a subview of) a UIScrollView.
     
  3. thread starter macrumors newbie

    Joined:
    Oct 15, 2009
    #3
    but dejo is it possible horizontal scrolling with portrait view and on top of that the carousel only has to scroll not the screen corresponding to the carousel item.
     
  4. Moderator

    dejo

    Staff Member

    Joined:
    Sep 2, 2004
    Location:
    The Centennial State
    #4
    Yes, it's possible. See my app, [app]a.k.a.[/app], for an example.
     
  5. thread starter macrumors newbie

    Joined:
    Oct 15, 2009
    #5
    Thanks dejo, it looks gr8. Even i want also same sort of thing. Can you pls share the part of code where you r scrolling the segment control on top the app screen.
     
  6. Moderator

    dejo

    Staff Member

    Joined:
    Sep 2, 2004
    Location:
    The Centennial State
    #6
    Not much code really. I create the UISegmentedControl and make it a subview of the UIScrollView. Then I set the contentSize of the scrollView to match the segmentedControl. The scrolling then takes care of itself because it's, yunno, a scrollView.
     
  7. thread starter macrumors newbie

    Joined:
    Oct 15, 2009
    #7
    am doing the same here, i dunno why the hell its nt coming.:confused:
    may be am giving wrong contentSize for the scrollview.
     
  8. Moderator

    dejo

    Staff Member

    Joined:
    Sep 2, 2004
    Location:
    The Centennial State
    #8
    Maybe. Here's how I do it:
    Code:
    self.segmentScrollView.contentSize = CGSizeMake(self.nameTypeSegmentedControl.frame.size.width, self.segmentScrollView.frame.size.height);
     

Share This Page