https://github.com/irons163/iruserresizableview-swift
IRUserResizableView-swift is a powerful resizable view for iOS.
https://github.com/irons163/iruserresizableview-swift
ios resizeable resizeableview swift
Last synced: about 1 year ago
JSON representation
IRUserResizableView-swift is a powerful resizable view for iOS.
- Host: GitHub
- URL: https://github.com/irons163/iruserresizableview-swift
- Owner: irons163
- Created: 2020-08-25T03:15:34.000Z (almost 6 years ago)
- Default Branch: master
- Last Pushed: 2020-08-25T03:28:07.000Z (almost 6 years ago)
- Last Synced: 2025-01-17T05:24:06.013Z (over 1 year ago)
- Topics: ios, resizeable, resizeableview, swift
- Language: Swift
- Homepage:
- Size: 123 KB
- Stars: 2
- Watchers: 3
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README


# IRUserResizableView-swift
- IRUserResizableView-swift is a powerful resizable view for iOS.
- IRUserResizableView-swift is modeled after the resizable image view from the Pages iOS app. Any UIView can be provided as the content view for the IRUserResizableView-swift. As the view is respositioned and resized, setFrame: will be called on the content view accordingly.
- Objc version see here:[IRUserResizableView](https://github.com/irons163/IRUserResizableView)
## Features
- Resizable.
## Install
### Git
- Git clone this project.
- Copy this project into your own project.
- Add the .xcodeproj into you project and link it as embed framework.
#### Options
- You can remove the `demo` and `ScreenShots` folder.
### Cocoapods
- Not support yet.
## Usage
### Basic
``` swift
import IRUserResizableView_swift
...
override func viewDidLoad() {
super.viewDidLoad()
let appFrame = UIScreen.main.bounds
self.view = UIView.init(frame: appFrame);
self.view.backgroundColor = .green;
// (1) Create a user resizable view with a simple red background content view.
let gripFrame = CGRect.init(x: 50, y: 50, width: 200, height: 150)
let userResizableView = IRUserResizableView.init(frame: gripFrame)
let contentView = UIView.init(frame: gripFrame);
contentView.backgroundColor = .red;
userResizableView.contentView = contentView;
userResizableView.delegate = self;
userResizableView.showEditingHandles()
self.view.addSubview(userResizableView)
}
```
If you'd like to receive callbacks when the IRUserResizableView-swift receives touchBegan:, touchesEnded: and touchesCancelled: messages, set the delegate on the IRUserResizableView-swift accordingly.
``` swift
userResizableView.delegate = self
```
Then implement the following delegate methods.
``` swift
func userResizableViewDidBeginEditing(userResizableView: IRUserResizableView)
func userResizableViewDidEndEditing(userResizableView: IRUserResizableView)
```
By default, IRUserResizableView-swift will show the editing handles (as seen in the screenshot above) whenever it receives a touch event. The editing handles will remain visible even after the userResizableViewDidEndEditing: message is sent. This is to provide visual feedback to the user that the view is indeed moveable and resizable. If you'd like to dismiss the editing handles, you must explicitly call -hideEditingHandles.
The IRUserResizableView-swift is customizable using the following properties:
``` swift
var minWidth: CGFloat = 0.0
var minHeight: CGFloat = 0.0
var preventsPositionOutsideSuperview: Bool?
```
For an example of how to use IRUserResizableView-swift, please see the included example project.
## Screenshots

## Copyright
##### This project is inspired from [SPUserResizableView](https://github.com/spoletto/SPUserResizableView).