Author Topic: How can I create a round image in Swift?  (Read 2340 times)

kjmcneish

  • Administrator
  • *****
  • Posts: 719
    • View Profile
How can I create a round image in Swift?
« on: March 30, 2015, 12:36:37 PM »
You can create a round image in swift by modifying the cornerRadius property of an image view. For example:

Code: [Select]
self.imgClose.layer.cornerRadius = self.imgClose.frame.size.width / 2
self.imgClose.clipsToBounds = true

All the best!
Kevin McNeish
Author of Learn to Code in Swift: https://itunes.apple.com/us/book/learn-to-code-in-swift/id942956811?mt=11
« Last Edit: March 30, 2015, 12:39:54 PM by kjmcneish »