Draggable, sizeable view which can placed in screen edges. Similar to FaceTime and PiP.
To run the example project, clone the repo, and run
pod install from the Example directory first.
// Your gorgeous content view UIView *contentView = [UIView new]; contentView.backgroundColor = [UIColor redColor]; // Init Picture in Picture view self.pipView = [[GKPictureInPictureView alloc] initWithContentView:contentView]; // Show it [self.pipView addToSuperView:self.blue animated:YES];
GKPictureInPictureView is available through CocoaPods. To install
it, simply add the following line to your Podfile:
GKPictureInPictureView can be used either by initializing it from code (see the Example above) or by using Storyboards.
- Create your content view. It will be constrainted to the draggable view's edges, so don't add any constraints which can conflict with the size or position
- Create a GKPictureInPictureView and init it with
- Add it to your superview:
- Create a
UIView. You can create whatever subviews you want, but don't set any constraints to width, height and position
- Change the class of the view to
There are plenty of options you can choose from. For example you can prevent the view to go to certain edges by setting NO on options like
bottomLeftPositionEnabled. You can also disable zooming. See GKPictureInPictureView.h headers for details.