Creating a ScrollView that works like Pages
I'm trying to create a scroll view that works like Apple's Pages app on the iPad. See pic below. I can create a similar scroll view with subviews containing the individuals pages, spaced apart as shown, and with pagingEnabled, it scrolls OK, but I want to achieve a scrolling effect that keeps the subviews centered once they've scrolled completely into view. So I want each page to scroll to a centered position in the scrollview, but as the pagingEnabled behavior scrolls the entire bou开发者_C百科nds left or right, I end up with a partial page or pages showing. What would be a good approach to this?
Thanks!
//Scott
So the secret is to is to set the scrollview to not clip it's subviews and make the scrollview bounds smaller than the screen width. Presto....the behavior I'm looking for. Now if I could only figure out how to get the subviews to have shadows like shown above.
#import QuartzCore/QuartzCore.h
contentContainer.layer.shadowOffset = CGSizeMake(0, 10);
contentContainer.layer.shadowRadius = 5;
contentContainer.layer.shadowOpacity = 0.5;
assuming that the contentContainer is a UIView containing the image and the label "tap to get started with pages" ect. ect.
How do I draw a shadow under a UIView?
精彩评论