Storyboard and autolayout: how make a circular image

前端 未结 7 705
逝去的感伤
逝去的感伤 2021-01-01 02:27

in storyboard (xcode 6) i want a circular user image profile take from Facebook.

So i have make this interface in storyboard, using auto layout:

7条回答
  •  猫巷女王i
    2021-01-01 02:37

    More steps:

    1. Add aspect ratio constraint 1:1
    2. mark check clip to bounds attribute in attribute inspector
    3. make outlet of your view into you controller class
    4. set corner radius to half of either its height or width

      yourImageViewOutlet.layer.cornerRadius = yourImageViewOutlet.frame.size.width / 2.0

提交回复
热议问题