• Stars
    star
    611
  • Rank 70,883 (Top 2 %)
  • Language
    Objective-C
  • License
    MIT License
  • Created over 12 years ago
  • Updated almost 12 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Zoom, Rotate, Drag โ€“ everything at the same time. A view-container for direct manipulation, inspired by Our Choice from Push Pop Press.

PSPushPopPressView

PSPushPopPressView is a custom view that provides direct manipulation for your content - like the images and videos in Our Choice by Push Pop Press. All credit for coming up with the interaction and use of such an interaction goes to Push Pop Press. This view tries to imitate the interaction they have perfected in Our Choice.

Credits go to Martin Reichart by Blacksmith Software, who sent me a initial implementation.

Be sure to test this on an real iPad, not the Simulator - it's much more awesome to feel it. And use all of your fingers, you can manipulate multiple views concurrently!

PSPushPopPressView

Zoom, Rotate, Drag - everything at the same time. In this example, the background is zoomed out and transparency is added while the transform is active.

Features

  • Two-finger direct manipulation support to scale, pan and rotate
  • Tap support to go into fullscreen and back to the original frame (delegate can block this individually and this is also disabled if you add a button as a subview and the user tapped the button)
  • Fully animates when going into fullscreen or back to the view's original frame
  • Semi-realistic bounce effect for scale and position depending on "distance" of view relative to it's target appearance (e.g. when the view needs to move a lot back to it's position there is more bounce than we the view only needs to move a little; also applied to changes in scale)
  • Detaches from the current view and docks on the main view, so that your view always expands to the full screen. This is especially useful if you're adding PSPushPopPressView's in a complex view hierarchy.

ARC

PSPushPopPressView uses ARC and works with iOS 4.0 upwards. You need at least Xcode 4.2 with LLVM 3.0 to compile it.

How to use it

Create an instance of PSPushPopPressView, insert it into your view hierarchy and you're done.

    // create the push pop press container
    PSPushPopPressView *pushPopPressView = [[PSPushPopPressView alloc] initWithFrame:CGRectMake(140, 20, 500, 400)];
    pushPopPressView.pushPopPressViewDelegate = self;
    [self.view addSubview:pushPopPressView];

You can add any UIView to the container. Just make sure it's autoresizable (else it won't look that great). Also note that adding subviews which offer userInteraction on their own (e.g. UIWebView or UIScrollView) might mess up the interaction with the view.

    // add a cat image to the push pop press view
    UIImageView *catImage = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"cat.jpg"]];
    catImage.frame = pushPopPressView.bounds;
    catImage.autoresizingMask = UIViewAutoresizingFlexibleHeight | UIViewAutoresizingFlexibleWidth;
    catImage.clipsToBounds = YES;
    [pushPopPressView addSubview:catImageView];

This is just a simple example. In the Example project, there's code how to embed video this way, and also code that 'zooms out' the whole view like you've probably seen in OurChoice.

You can set yourself as a PSPushPopPressView to receive callbacks when the user starts/stops manipulating the view or when the view will/did go into fullscreen or back to it's original frame.

ToDo/Known Issues

  • Shadow animation is tricky, and sometimes the animation looks pretty bad.

  • Touches are sometimes not correctly recognized, which leads to manipulation even though the delegates tell you no one's dragging it atm.

  • When a animating and rotating at the same time, sometimes the view frame is reset incorrectly.

Don't worry - it works pretty well, and is used for month now in production - people love it!

License

PSPushPopPressView is released under the MIT-license (see the LICENSE file)

Support / Contact / Bugs / Features

I happily accept pull requests, and feel free to contact Peter or Martin on Twitter.

More Repositories

1

Aspects

Delightful, simple library for aspect oriented programming in Objective-C and Swift.
Objective-C
8,383
star
2

PSTCollectionView

Open Source, 100% API compatible replacement of UICollectionView for iOS4.3+
Objective-C
2,546
star
3

PSStackedView

open source implementation of Twitter/iPad stacked ui - done right.
Objective-C
1,970
star
4

AFDownloadRequestOperation

A progressive download operation for AFNetworking.
Objective-C
1,051
star
5

InterposeKit

A modern library to swizzle elegantly in Swift.
Swift
962
star
6

PSPDFTextView

A subclass of UITextView that fixes the most glaring problems from iOS 7 and 7.1.
Objective-C
877
star
7

PSTAlertController

API similar to UIAlertController, backwards compatible to iOS 7. Will use the new shiny API when you run iOS 8.
Objective-C
737
star
8

PSFoundation

Categories and helper classes for iOS projects.
Objective-C
570
star
9

PSTDelegateProxy

A simple proxy that forwards optional methods to delegates - less boilerplate in your code!
Objective-C
256
star
10

PSYouTubeExtractor

Display YouTube URLs in a MPMoviePlayerController
Objective-C
191
star
11

PSMenuItem

A block based UIMenuItem subclass.
Objective-C
179
star
12

PSPDFKit-Demo

A drop-in-ready framework that helps in almost every aspect of PDF-rendering on iOS.
Objective-C
178
star
13

UIKitDebugging

A set of files that enables various debug flags in UIKit
Objective-C
178
star
14

PSiOSAppTemplate

iOS Application Template with JSON-Parsing, AutoUpdating, CrashReporter+Sender, Statistics, custom Logging, Localization and all those little things already set up, ready for you to make awesome stuff!
Objective-C
174
star
15

PSAlertView

Modern block-based wrappers for UIAlertView and UIActionSheet.
Objective-C
129
star
16

PSStoreButton

UIButton that is styled like iPhone's AppStore-Button. No Images used!
Objective-C
91
star
17

PSTCenteredScrollView

Shows off different ways to center content in a UIScrollView.
Objective-C
79
star
18

NSLogger-CocoaLumberjack-connector

65
star
19

xcode-theme-solarized-modded

Heavily modded theme based on the Solarized style: http://ethanschoonover.com/solarized/
49
star
20

iOS6-Runtime-Headers

6.0 (GM)
Objective-C
47
star
21

speaking

Upcoming and past speaking engagements for Peter Steinberger (@steipete).
47
star
22

OSLogTest

Test app for OSLog
Swift
45
star
23

PSBackgroundCurtain

Fades the App to black/semi-black when in Background. Fully animated.
44
star
24

PSTFoundationBenchmark

Foundation Collection Classes Benchmarks
Objective-C
37
star
25

SwiftUITouchHandling

Testing touch handling from embedded SwiftUI views
Swift
28
star
26

stackoverflowerizer

always redirect to stackoverflow from pages that just copy the content, like efreedom
JavaScript
15
star
27

steipete.com

Personal Website of Peter Steinberger.
SCSS
13
star
28

dotfiles

my dot files for bash, git, rails and co
Shell
4
star