See Creating UIViews Programmatically with Auto Layout for more information.
Creating UIViews Programmatically with Auto Layout