So if it succeeds, that'll bring up the simulator, and press Filter, and yeah,
that's our view.
It's up there in the corner, not where we want it, not how we want it to look.
But it's definitely there.
And that's pretty nice.
So to put it where we want it, we're going to use Auto Layout constraints.
And if we were in the storyboard, let's just look at it here,
at this size, how would we, just think about how we would constrain it.
We would constrain this bottom edge to the top edge of our bottom view and
the sides to the view, and probably give it a height of let's say, 44,
which is the recommended size of a button.
Again, and so we're gonna do it in code this time.
And luckily, in iOS 9 and Xcode 7, we have a new way to create
constraints that's much more convenient than before using anchors.
Anchors are pretty much what you see in the storyboard,
like when you drag, when you select your storyboard, then you see this.
You see that the little blue connection, which is the constraint that constrains,
say, this image view to the bottom view.
It's sort of like anchoring the top of this view to the bottom of this view.
And iOS9 now lets us express that very well like this.
We're gonna create, define a bottom constraint for our secondary menu.
And you simply find the bottom anchor of our secondary menu.
And there's a method on that called constraint equal to another anchor.
And that's gonna be our bottom menu's top anchor.
And then there you've got a constraint that does exactly what we just said, but
it's actually not attached or activated yet.
You've created an object that represents a constraint that would constrain the bottom
of the secondary menu to the top of our bottom menu, but
it's not added into the layout hierarchy yet.
Kind of like you need to add subview to view, you need to add a constraint.
We're gonna do that in a bit.
We're gonna create the rest of the constraints.
And you need a left one, and we'll take the left anchor and then we're gonna
make it equal to, instead of the bottom menu, the view's left anchor.
Technically, it would work, the bottom menu's left anchor would work too,
because that's constrained to the view.
We're gonna make it more explicit,
as we want it to be more clear to everyone reading this.
And the right anchor is the same.
view.rightAnchor.
Cool.
Lastly, we need to constrain the height.
Well, we don't know how high and tall it's going to be.
So the heightConstraint, there's also a height anchor,
which doesn't make too much sense at the beginning, but once you see this
constraintEqualToConstant method it'll make sense again.