UIScrollview with UIButtons – how to recreate springboard?

Solution that worked for me included: Setting canCancelContentTouches in UIScrollView to YES. Extending UIScrollView to override touchesShouldCancelInContentView:(UIView *)view to return YES when view is a UIButton. According to documentation touchesShouldCancelInContentView returns “YES to cancel further touch messages to view, NO to have view continue to receive those messages. The default returned value is YES if … Read more

How to enable zoom in UIScrollView

Answer is here: A scroll view also handles zooming and panning of content. As the user makes a pinch-in or pinch-out gesture, the scroll view adjusts the offset and the scale of the content. When the gesture ends, the object managing the content view should update subviews of the content as necessary. (Note that the … Read more

Snap to center of a cell when scrolling UICollectionView horizontally

While originally I was using Objective-C, I since switched so Swift and the original accepted answer did not suffice. I ended up creating a UICollectionViewLayout subclass which provides the best (imo) experience as opposed to the other functions which alter content offset or something similar when the user has stopped scrolling. class SnappingCollectionViewLayout: UICollectionViewFlowLayout { … Read more

Scrolling with two fingers with a UIScrollView

In SDK 3.2 the touch handling for UIScrollView is handled using Gesture Recognizers. If you want to do two-finger panning instead of the default one-finger panning, you can use the following code: for (UIGestureRecognizer *gestureRecognizer in scrollView.gestureRecognizers) { if ([gestureRecognizer isKindOfClass:[UIPanGestureRecognizer class]]) { UIPanGestureRecognizer *panGR = (UIPanGestureRecognizer *) gestureRecognizer; panGR.minimumNumberOfTouches = 2; } }

Disabling automatic scrolling of UITableView when editing UITextField inside UITableViewCell

The autoscroll-behavior is located in the UITableViewController functionality. To disable the automatic scrolling I found two ways: Use instead of the UITableViewController simply a UIViewController – set the datasource and delegate on your own. Override the viewWillAppear method and don’t call [super viewWillAppear: animated] With both solution you disable not only the Autoscroll, but also … Read more