

- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
How to resize an UIImageView using Swift?
To resize an image in iOS using swift we’ll make use of frame.
Let’s see this with help of an example.
Create an empty project and add an empty Image view.
Create its outlet.
Add an image to your project and assign the image to image view.
Initially when we run the application, it looks something like this.
Now, let’s add code to resize the image.
override func viewWillLayoutSubviews() { let frame = CGRect(x: 10, y: 10, width: self.view.frame.width - 20, height: 300) self.imgView.frame = frame }
We will run this code in our viewWillLayoutSubviews method. This is how it looks on the device when we run this.
- Related Questions & Answers
- How to resize an image using Tkinter?
- How to resize an image in Android using Picasso?
- How to resize an Image C#?
- How to send an attachment in email using Swift?
- How to send an attachment in email using Swift(ios)?
- How to resize an array in Java?
- How to Resize an image in Android using Picasso on Kotlin?
- How to resize textarea dynamically using jQuery?
- How to make an HTTP request on iOS App using Swift?
- How to create a WebView in an iOS App using Swift?
- How to resize an object non-uniformly via corner points using FabricJS?
- How to resize an image in Node Jimp?
- How to detect shake gesture using Swift?
- How to make iPhone vibrate using Swift?
- How to load and display an image on iOS App using Swift?
Advertisements