Auto LayoutでCustom Viewを作成し、それをViewController#viewに配置する方法について説明します。 サンプルコード: https://github.com/stack3/iOSAutoLayoutSamples サンプルコードのCustomViewを選択すると以下の画面が表示されます。 横画面にするとこうなります。 STCustomView.xib グレー背景の部分がCustomViewで、これはSTCustomView.xibでレイアウトされています。 構成は以下のとおり。 UIView – backgroundColorをgrayにしている UIImageView – アイコン表示 UILabel – 文字列表示 UIImageViewのConstraintは以下のようになっています。 要するに幅と高さは32pxでSuperviewとの間隔は8pxと
![Auto LayoutでCustom Viewを作る その1 | Cyber Passion for iOS](https://cdn-ak-scissors.b.st-hatena.com/image/square/02552bde15f1ebb0decca19552fb781232f990f4/height=288;version=1;width=512/http%3A%2F%2Fblogios.stack3.net%2Fwp-content%2Fuploads%2F2015%2F04%2Fcyberpassion-logo-ogp.png)