Q:

Content view width not taking main views width if scroll view is used

I have placed my content view inside scroll view. Also I have set the equal width constraint for content view and main view. Even then the content view has its size based on its sub views.
Screenshot:
 
There is a space after the content view. (content view background is yellow). This is only with iphone 4s simulator 

A:

I think the problem is that the subviews of your content view are not flexible enough horizontally.  Since your layout needs to work on all iPhones, the content will be much wider on the iPhone 6s than the iPhone 4s.
For instance, if your "NO" image width has an absolute value, and it has an absolute leading distance to the content view and absolute trailing distance to the content view, then the content view will be over constrained.  You have competing constraints telling the content view how wide it should be:  1) equal to the width of the screen or 2) equal to the width of the contained image plus its distances from the sides of the screen.  With too many constraints on your content view size, Auto Layout may not choose the constraints you'd like and you can end up with the content view not sized as you would like or expect.
Instead, you should either:

Allow the image to float: Define the width of the image and then center it in the content view.  This will allow the distances to the sides to expand on larger devices.  OR
Allow the image to grow: Set the leading and trailing edge constraints to constant distances, but do not set a width for the image.  This will allow the image to stretch on larger devices.  Set an aspect ratio constraint to allow the image height to grow proportionally with the image width to maintain the proportions.  Be sure to remove any other height constraints on the image if you set the aspect ratio or your image might will be overly constrained and not grow.
Repeat this with the other subviews in your content view, making sure that they either float or grow horizontally in the content view.
You might need to treat the vertical size of your content view differently.  In the vertical direction, you probably haven't constrained the height of the content view, so then you must make sure that the subviews have explicit heights (or are constrained in some other way like with an aspect ratio constraint), the subviews should be connected to each other in a chain from the top of the screen to the bottom of the screen with absolute distances.  The top most subview should have a vertical distance to the top of the content view.  The bottom most subview should have a vertical distance to the bottom of the content view.  This will give Auto Layout enough information to calculate the height of your content view.

