I make a simple calculator, the screen is divided into two parts: on top - the scoreboard with the result, on the bottom - the keyboard (I create it myself from different buttons). I plan to fasten the svayp (moving your finger left / right), this movement does not move the entire screen, and the keyboard changes with the usual actions (multiplication, division) on the keyboard with advanced operations. Here's how to make a similar UIView so that when you swipe, only the bottom of the screen changes? This is obviously a few UIViews to create, and how can they be glued together then?
UPDATE :
It seems to have figured out, I don’t know how correct it is, but here’s the code, who can come in handy:
containerView.translatesAutoresizingMaskIntoConstraints = false containerView.pagingEnabled = true redView.translatesAutoresizingMaskIntoConstraints = false containerView.addSubview(redView) greenView.translatesAutoresizingMaskIntoConstraints = false containerView.addSubview(greenView) let views = [ "greenView" : greenView, "redView" : redView, "view" : containerView ] view.addConstraints(NSLayoutConstraint.constraintsWithVisualFormat("V:|[redView(==view)]|", options: [], metrics: nil, views: views)) view.addConstraints(NSLayoutConstraint.constraintsWithVisualFormat("V:|[greenView(==view)]|", options: [], metrics: nil, views: views)) view.addConstraints(NSLayoutConstraint.constraintsWithVisualFormat("H:|[redView(==view)][greenView(==view)]|", options: [], metrics: nil, views: views))
Where containerView is UIScrollView
redView and greenView - UIView
self.view
two subviews each the size of the screen floor to your controller's self.view: the top one is a calculator, and the bottom one isUIScrollView
with pagingEnabled. To do this I twist the size to be two screens wide, on the first one clave, on the second the other. Everything. - Max Mikheyenko