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

Show/hide UIToolbar, “match finger movement”, precisely as in for example iOS7 Safari

There is no open-source that does this, but I don’t see it as that difficult to implement. It may be somewhat more difficult to have the exact 1:1 behavior as Safari, but it can still be done. MobileSafar can be attached to in the debugger and, using breakpoints and the Objective C runtime, debugged and … Read more

Auto layout UIScrollView with subviews with dynamic heights

I use pure structure like the following -view -scrollView -view A -view B -Button Make sure Button(THE LAST view) has a constraint(vertical spacing from its bottom to superview, which is the scrollview), in this case, no matter what changes for your view A and view B would be, scrollView’s height will be changed accordingly. I … 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

tech