-2

How to setImage in UIButton in Round shape ,select photo using ImagePickerView

enter image description here

J. Chomel
  • 8,193
  • 15
  • 41
  • 69
  • Hi Kathir, and welcome to SO. If you take a little tour of the questions asked and well answered here, you'll see it is better to post the parts of the code you think must be improved. You must show at least some research efforts. Read http://stackoverflow.com/help/how-to-ask for more. – J. Chomel May 12 '16 at 09:12
  • Possible duplicate of [How to set imageView in circle like imageContacts in Swift correctly?](http://stackoverflow.com/questions/25587713/how-to-set-imageview-in-circle-like-imagecontacts-in-swift-correctly) – Jigar Tarsariya May 12 '16 at 09:15

1 Answers1

1

Write like,

    self.btn.frame = CGRectMake(70, 300, 100, 100)
    self.btn.setBackgroundImage(UIImage(named: "ImageName"), forState: UIControlState.Normal)  // Assign your selected image from imagePicker
    self.btn.layer.borderWidth = 1
    self.btn.layer.masksToBounds = false
    self.btn.layer.borderColor = UIColor.blackColor().CGColor
    self.btn.layer.cornerRadius = self.btn.frame.height/2
    self.btn.clipsToBounds = true

Its working fine.

Jigar Tarsariya
  • 3,189
  • 3
  • 14
  • 38