Giter VIP home page Giter VIP logo

zdstickerview's Introduction

ZDStickerView

ZDStickerView is an Objective-C module for iOS and offers complete configurability, including movement, resizing, rotation and more, with one finger.

How To Use It

Installation

Include ZDStickerView folder in your project.

Setting up the ZDStickerView

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

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

Features

Longpress event is disabled by default. If you want enable it, just define it in .pch file follows:

    #define ZDSTICKERVIEW_LONGPRESS

Credits

I started from TDResizerView and SPUserResizableView. r-dent and sedwo contributed a lot.

Licence

ZDStickerView is distributed under the terms and conditions of the MIT license.

zdstickerview's People

Contributors

leandros avatar morteza2128 avatar zedoul 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  avatar  avatar  avatar  avatar  avatar

zdstickerview's Issues

Push version tags to GitHub

Hello, @zedoul
Just found this nice UI component 👍

As I saw there're 0.1.15 & 0.1.16 release branches merged into master, could you please also push those two tags to GitHub?

git push --tags

Thanks in advance!

Resize changes aspect ratio

Resizing a view that isn't square changes the aspect ratio. You can replicate this by using a 200 x 100 picture.

Not working on uiimageview

It is not working on Imageview. Means when we add zdstickerview to image then we can't able to move . How can i make it work ?

Bug with resizing frame after frame is set first time

Hey nice work on the sticker view. I'm having an issue though. Here's what I'm doing...

  1. init and create the sticker view and set the frame
  2. the user can edit the contents inside the sticker (the content view) and sometimes this requires the frame size to change.
  3. ive noticed if the user has previously resized/rotated the view before step2 and in that step the content view frame had to change, if the user then tries to go back and resize/rotate with the handles... the sticker view gets "wonky"... it starts to shrink exponentially and it basically breaks and becomes unusable for the user...

I hope that makes sense... I've tried to go in and tinker around to see if i could fix it... but so far I havent been able to. I'm wondering if the deltaAngle variable needs to be updated based on the new frame or something?

Thanx again for your work and releasing it... I hope you might have a few minutes to look into this, or at least maybe point me in a direction to fix it! Thanx!

Resize of textview only resize the UIview

Thanks for your valuable effort.

I have tried the code and find out the resizing effect only resize the container (the UIView) not the actual text font. Is there a property or control that I can use to make the text font resized while dragging the handles ?

Adding layering UIView feature

Hi, such an awesome tool. Any chance you are going to add a speech bubble feature? modifying the text input method to have a tail that can be dragged/ repositioned would be wonderful -- gary

-> You mean bubble effects in cartoon/manga, right? I guess i should add "UIImageView" and "UITextView" in one. Layering UIView might be an Interesting point what I didn't think of.

I will try it :-)

(https://www.cocoacontrols.com/controls/zdstickerview)
(https://itunes.apple.com/us/app/halftone/id419957803?mt=8)

Wrong checking value

ZDStickerView.m

line 93 if (self.bounds.size.width < minWidth || self.bounds.size.width < minHeight)

should be self.bounds.size.height < minHeight

when the view is width > height, this issue make the view can't scale

Thanks for sharing.Feedback problems

感谢分享。这个东西确实解决了初学者不会的难题。所需要的功能基本在里面。但是问题还是蛮多的。 开始以为不是我要的东西。但是后面发现。里面考虑的几个属性参数还是挺多的。拉伸是否等比拉伸。是否在父视图布局内等。 但是我发现的几个问题如下 1.旋转手势明显和移动手势有冲突。多重复几次。你会发现你的控件还是偏移了很多。 2.虽然考虑到移动时候是否在父视图布局内。可是你TM的。为什么不考虑旋转的时候呢。。。。。。。 最后还是感谢分享。这个地方卡了我整整一天多。现在基本实现了。只能靠自己优化了。或者哪个大神看到有类似很完美的。记得分享@我一下。谢谢了

Thanks for sharing. This thing does not really solve the problem for beginners. Basic functions needed inside. But the question still find many. I began to think that is not what I want. But later found. Some attribute parameter inside or with a lot of consideration. Whether drawing geometric drawing. Whether in the parent view layout. But I found a few problems as follows 1. Rotate gestures visible and moving gesture conflict. Repeated many times. You will find your control or offset a lot. 2. While considering whether to move when the parent view within the layout. But you (TM). Why not consider the time it rotates. . . . . . . Finally thanks for sharing. The whole day I place the card more. Now the basic realization. We can only rely on their own optimized. Or which Great God see similar very perfect. Remember share @ me. Thank you

Shape resize issue with UIBezierPath

Hi, I created shapes using 'UIBezierPath' and 'CAShape layer' and then added to stickerview. But I couldn't resize it. Anyone please help me to sort this out. Thanks in advance.

Resizing

I have set the property userResizableView1.preventsPositionOutsideSuperview = YES; but when i resize it, it grows even more and more bigger then its parent view, and when i lift up the finger then, It gets stuck because it gets too much bigger then the parent view so doesnt move, resize or rotate anymore. Please find the attached image, the pink View is its parentView.
img_0827

Turning off Resizing

Hello. Firstly, amazing code, thanks for sharing it!

I'm trying to turn off just the Resizing option - but maintain the drag, rotate and delete. I've tried commenting out various parts of ZDStickerView.m and can disable Resizing, but when I click on the Rotate button, there is a brief moment when it is dragging the image before it starts to rotate. I want to only drag the image when I tap on it and only rotate the image when I tap on the rotate button.

Many thanks for any guidance in advance!

preventsPositionOutsideSuperview = YES restricts the view unexpectedly

Here is my code

   CGRect frame = CGRectMake(50, self.wineLabelImageView.frame.origin.y+10, 100, 50);
    UITextView *textView = [[UITextView alloc] initWithFrame:frame];
    textView.text = @"Sample Text";
    textView.backgroundColor = [UIColor clearColor];
    textView.editable = NO;
    textView.delegate = self;
    textView.textColor = [UIColor greenColor];

    ZDStickerView *userResizableView = [[ZDStickerView alloc] initWithFrame:frame];
    userResizableView.tag = 1;
    userResizableView.delegate = self;
    userResizableView.contentView = textView;
    userResizableView.preventsPositionOutsideSuperview = YES;
    userResizableView.preventsCustomButton = NO;
    [userResizableView setButton:ZDSTICKERVIEW_BUTTON_CUSTOM
                           image:[UIImage imageNamed:@"Write.png"]];
    userResizableView.preventsResizing = NO;
    [userResizableView hideEditingHandles];
    [self.containerView addSubview:userResizableView];

But when I try to drag the ZDStickerView within my containerView (white colored) , it restricts the ZDStickerView before the actual boundary of container view as shown in below screenshots

left

right
top
bottom

Can you tell me whats going wrong in my code ?

Error when Resizing Image greater than superview

I got an error when trying to resize image greater than my superview. I just can't move, delete, or resize it back.

Suggested solution: I guess you should keep checking if ZDStickerView instance is greater than its superview. If yes, do not allow to scale up. It is just my idea, and I am looking forward to seeing your updates.

Anyway, I am appreciated all your hard working. I love your framework a lot. :)

Remove resizing control and deletecontrol.

Hi ! thanks for awsome control. I am adding saveral of zdsticker view on one single uiview according to my project's requirement. when user will add secondview then 1st view's resize and delete control disabled. so, I want to set tap gesture - when user will again click on 1st view or any other added zdstickerview then resizecontrol and delete control will appear again on that view. (zdstickerview which click by user). How can i achive this ? need your help please. Actually i have tried it but it will hide control from only last edited zdstickerview. (means it will recognize only last edited control)

Here is my code :

           - (IBAction)btnScrollsub:(id)sender {
CGRect gripFrame1 = CGRectMake(150, 150, 140, 140);

_btnLeftbarButton.title=@"Apply";
self.navigationItem.hidesBackButton = false;


UIButton *button = (UIButton*)sender;
//TODO: ==Set image for subcategory Images==
if (button.tag == 0) {
    NSLog(@"==%@",[arySubImagesarray objectAtIndex:0]);
    _image= button.currentImage;

} else if (button.tag == 1) {
     _image = button.currentImage;


} else if (button.tag == 2){

     _image = button.currentImage;


}
//===========================================================

_imageView=[[UIImageView alloc]init];
_imageView.image=_image ;
_imageView.backgroundColor=[UIColor clearColor];

UIView* contentView = [[UIView alloc] initWithFrame:gripFrame1];
[contentView setBackgroundColor:[UIColor clearColor]];
[contentView addSubview:_imageView];



userResizableView1 = [[ZDStickerView alloc] initWithFrame:gripFrame1];
userResizableView1.tag = 0;

userResizableView1.stickerViewDelegate = self;
userResizableView1.contentView = contentView;//contentView;
contentView.backgroundColor=[UIColor clearColor];
userResizableView1.preventsPositionOutsideSuperview = YES;
userResizableView1.translucencySticker = NO;
userResizableView1.backgroundColor=[UIColor clearColor];
[userResizableView1 showEditingHandles];
[_vwBackup addSubview:userResizableView1];
[userResizableView1 bringSubviewToFront:_vwBackup];

}

and here is action when user click on apply button.

            - (IBAction)btnLeftbarButton:(UIBarButtonItem *)sender {
      NSString *str;
     str= _btnLeftbarButton.title;

     if ([str isEqual:@"Apply"]) {


    for (int i = 0; i < userResizableView1.tag; i++) {

    }

    userResizableView1.userInteractionEnabled=NO;
    userResizableView1.resizingControl.hidden=YES;
    userResizableView1.deleteControl.hidden=YES;
    userResizableView1.resizingControl.hidden=YES;
    userResizableView1.borderView.hidden=YES;
    }




    else if (_vwRootView.hidden==NO && _menuView.hidden==YES && [str isEqual:@"Back"])  {


    _vwRootView.hidden=YES;
    _menuView.hidden=NO;

    userResizableView1.userInteractionEnabled=NO;
    userResizableView1.resizingControl.hidden=YES;
    userResizableView1.deleteControl.hidden=YES;
    userResizableView1.resizingControl.hidden=YES;
    userResizableView1.borderView.hidden=YES;

   }
     else if (_menuView.hidden==NO || [str isEqualToString:@"Home"])
    {

    UIAlertController * alert=   [UIAlertController
                                  alertControllerWithTitle:@"Go to Home"
                                  message:@"Are you sure you want to go to Home ?"
                                  preferredStyle:UIAlertControllerStyleAlert];

    UIAlertAction* yesButton = [UIAlertAction
                                actionWithTitle:@"Yes"
                                style:UIAlertActionStyleDefault
                                handler:^(UIAlertAction * action)
                                {
                                    //Handel your yes please button action here
                                    [self dismissViewControllerAnimated:NO completion:nil];

                                }];
    UIAlertAction* noButton = [UIAlertAction
                               actionWithTitle:@"No"
                               style:UIAlertActionStyleDefault
                               handler:^(UIAlertAction * action)
                               {
                                   [alert dismissViewControllerAnimated:YES completion:nil];

                               }];


     [alert addAction:yesButton];
     [alert addAction:noButton];
     [self presentViewController:alert animated:YES completion:nil];

                }
                 }

Here is my output. May be you can understand my intension from Image. wht i want to do .

http://postimg.org/image/bseg2huf3/

ANd here i have attached demo also 👍

http://s000.tinyupload.com/index.php?file_id=22480390446482136775

Thank you for Help.

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.