2015年2月11日水曜日

UIImageViewの角を丸くする方法

今回はUIImageViewの角を丸くする方法を紹介します。
まずはソースコードによる設定方法

  1. UIImageViewのプロパティ「clipsToBounds」にYESを設定する
  2. UIImageViewのプロパティ「layer」のプロパティ「cornerRadius 」に角丸の半径を設定する



次にストーリーボードを使った設定方法

  1. UIImageViewを選択して「Identity inspector」のメニューを表示する
  2. 「User Defined Runtime Attributes」にて「clipsToBounds」と「layer.cornerRadius」を追加して設定する


このエントリーをはてなブックマークに追加