Scroll view subclass inspired by the Instagram Stories cube.
- iOS >= 9.0
- Autolayout
Only supports portrait mode.
In your podfile, add pod 'OHCubeView' and run pod install. Done!
- Using interface builder, add a UIScrollView instance to the storyboard and make it a subclass of OHCubeView. Hook the instance up to an
IBOutletin the view controller.
- In your view controller, programmatically add subviews to the cube view (note that this can be any kind of UIView subclass). Layout constraints are automatically added to the subviews.
import UIKit
import OHCubeView
classViewController:UIViewController{@IBOutlet weak varcubeView:OHCubeView!overridefunc viewDidLoad(){
super.viewDidLoad()
// 1. Create subviews for our cube view (in this case, five image views)
letiv1=UIImageView(image:UIImage(named:"img1"))letiv2=UIImageView(image:UIImage(named:"img2"))letiv3=UIImageView(image:UIImage(named:"img3"))letiv4=UIImageView(image:UIImage(named:"img4"))letiv5=UIImageView(image:UIImage(named:"img5"))
// 2. Add all subviews to the cube view
cubeView.addChildViews([iv1, iv2, iv3, iv4, iv5])}}- Support for infinite paging
- Add custom delegate methods

