This answer shows the various effects of setting the content mode of a UIImageView.
Since UIView also has a content mode setting in the Interface Builder, I want to know why setting it doesn't affect any subviews that are in it.
Here is an example that I tried. The blue view is a UIView and the yellow view is a UILabel.
But if I set the mode to Top for the UIView, the label just stays in the same place.
Does content mode only work for UIImageViews? If it doesn't work for UIViews, why is it even there?


The
contentModemodifies only the views' contents and not its subviews'. So if you have a custom view and you draw something in itsdrawRectthen you will see that it gets changed every time you change thecontentModeof your view.Now in case of
UIImageView, the image is actually the content of the view (which is internally drawn in itsdrawRect), so you can see the image changing when you change thecontentModeof your UIImageView.