Q:

View with auto layout doesn't resize

I have a static UITableViewCell in a containerView with auto layout applied. In the containerView is a UIView. I set the border color of the containerView to orange, and the view to green. When I run it on the simulator I get the following results:
Constraints:

Portrait:

Landscape:

The green border color is applied to the outer view.
When the the simulator goes in landscape mode, the views' width doesn't become as small as it should be; as you can see the views' right green border is not shown. (I have the same issue with the second UISegmentedControl.) Can someone please explain why this happens and provide a solution?
Edit
When in portrait mode, the containerView (and another view) are 1 on top of another. When in landscape mode, they are side by side. That's why in landscape mode, the containerView is smaller.

A:

As per your requirements
first UISegmentedControl

second UISegmentedControl

Follow these links Autolayout or Autolayout programatically
This might helps you :)

