iOS App Development Book/Video Series

General Category => FAQs => Topic started by: kjmcneish on January 26, 2016, 02:53:04 PM

Title: How to Add a Border to an Image View
Post by: kjmcneish on January 26, 2016, 02:53:04 PM
It takes just two lines of code to add a border to an image view.

In Swift:

Code: [Select]
imageView.layer.borderWidth = 2.0
imageView.layer.borderColor = UIColor.whiteColor().CGColor

In Objective-C:

Code: [Select]
[[imageView layer] setBorderWidth:2.0f];
[[imageView layer] setBorderColor:[UIColor whiteColor].CGColor];

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 (https://itunes.apple.com/us/book/learn-to-code-in-swift/id942956811?mt=11)
Check out our Robot Tic-Tac-Toe app: https://itunes.apple.com/us/app/robot-tic-tac-toe/id990638517?mt=8 (https://itunes.apple.com/us/app/robot-tic-tac-toe/id990638517?mt=8)