
- iOS Tutorial
- iOS - Home
- iOS - Getting Started
- iOS - Environment Setup
- iOS - Objective-C Basics
- iOS - First iPhone Application
- iOS - Actions and Outlets
- iOS - Delegates
- iOS - UI Elements
- iOS - Accelerometer
- iOS - Universal Applications
- iOS - Camera Management
- iOS - Location Handling
- iOS - SQLite Database
- iOS - Sending Email
- iOS - Audio & Video
- iOS - File Handling
- iOS - Accessing Maps
- iOS - In-App Purchase
- iOS - iAd Integration
- iOS - GameKit
- iOS - Storyboards
- iOS - Auto Layouts
- iOS - Twitter & Facebook
- iOS - Memory Management
- iOS - Application Debugging
- iOS Useful Resources
- iOS - Quick Guide
- iOS - Useful Resources
- iOS - Discussion
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 Articles
- How to assign an action to the UIImageView object in Swift?
- How to resize an image using Tkinter?
- How to resize an image in Android using Picasso?
- How to resize an image in OpenCV using Python?
- How to resize an Image C#?
- How to Resize an image in Android using Picasso on Kotlin?
- How to resize an object non-uniformly via corner points using FabricJS?
- How to auto-resize an image to fit a div container using CSS?
- How to resize an array in Java?
- How to wait resize end event and then perform an action using JavaScript?
- How to resize an image in Node Jimp?
- How to resize Image in Android App using Kotlin?
- PyTorch – How to resize an image to a given size?
- How to send an attachment in email using Swift?
- How to resize an Entry Box by height in Tkinter?

Advertisements