PDA

View Full Version : carousel in iPhone




m1anoj
Oct 15, 2009, 10:49 PM
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....



dejo
Oct 16, 2009, 12:48 AM
I tried with UISegmentedControl, but with that i cant able to slide/scroll the segmented control.
You can if you put the UISegmentedControl inside (as a subview of) a UIScrollView.

m1anoj
Oct 16, 2009, 01:02 AM
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.

dejo
Oct 16, 2009, 01:16 AM
Yes, it's possible. See my app, a.k.a., for an example.

m1anoj
Oct 16, 2009, 01:36 AM
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.

dejo
Oct 16, 2009, 01:53 AM
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.

m1anoj
Oct 16, 2009, 01:57 AM
am doing the same here, i dunno why the hell its nt coming.:confused:
may be am giving wrong contentSize for the scrollview.

dejo
Oct 16, 2009, 09:30 AM
may be am giving wrong contentSize for the scrollview.
Maybe. Here's how I do it:
self.segmentScrollView.contentSize = CGSizeMake(self.nameTypeSegmentedControl.frame.size.width, self.segmentScrollView.frame.size.height);