GithubHelp home page GithubHelp logo

spoletto / spuserresizableview Goto Github PK

View Code? Open in Web Editor NEW
319.0 22.0 85.0 424 KB

SPUserResizableView is a user-resizable, user-repositionable UIView subclass built for iOS.

License: MIT License

Objective-C 100.00%

spuserresizableview's Introduction

SPUserResizableView

SPUserResizableView is a user-resizable, user-repositionable UIView subclass. It is modeled after the resizable image view from the Pages iOS app. Any UIView can be provided as the content view for the SPUserResizableView. As the view is respositioned and resized, setFrame: will be called on the content view accordingly.

Screenshot

SPUserResizableView

How To Use It

Installation

Include SPUserResizableView.h and SPUserResizableView.m in your project.

Setting up the SPUserResizableView

You'll need to #import the SPUserResizableView.h header and construct a new instance of SPUserResizableView. Then, set the contentView on the SPUserResizableView to the view you'd like the user to interact with.

#import "SPUserResizableView.h"

...
    
- (void)viewDidLoad {
    CGRect frame = CGRectMake(50, 50, 200, 150);
    SPUserResizableView *userResizableView = [[SPUserResizableView alloc] initWithFrame:frame];
    UIView *contentView = [[UIView alloc] initWithFrame:frame];
    [contentView setBackgroundColor:[UIColor redColor]];
    userResizableView.contentView = contentView;
    [self.view addSubview:userResizableView];
    [contentView release]; 
    [userResizableView release];
}

If you'd like to receive callbacks when the SPUserResizableView receives touchBegan:, touchesEnded: and touchesCancelled: messages, set the delegate on the SPUserResizableView accordingly.

userResizableView.delegate = self;

Then implement the following delegate methods.

- (void)userResizableViewDidBeginEditing:(SPUserResizableView *)userResizableView;
- (void)userResizableViewDidEndEditing:(SPUserResizableView *)userResizableView;

By default, SPUserResizableView 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 SPUserResizableView is customizable using the following properties:

@property (nonatomic) CGFloat minWidth;
@property (nonatomic) CGFloat minHeight;
@property (nonatomic) BOOL preventsPositionOutsideSuperview;

For an example of how to use SPUserResizableView, please see the included example project.

spuserresizableview's People

Contributors

spoletto avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

spuserresizableview's Issues

Cropped Image is adjusting the borders and shringking automatically

Hi Team,
Really its an fabulous job you guys have done, it would be appreciable, but I am getting an issue that after selecting the cropped image the iamge cropped will be automatically adjusting to the borders of the croppedView if I enlarge that.
And sometimes the image is shrinking when I use the eraseBackground method(tool).
Please fix this issue and help me in getting this.
Thanks in advance.

isuue of green border when crop

SPUserResizableView work well but when i crop the video it show green border on right side and bottom side of the video when crop is complete,some time show green line and some time working well , is there any solution for it?

Rotation

If you rotate the view, the resizing no longer works

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.