Giter Site home page Giter Site logo

single-hand-sticker's Introduction

About Single-hand-Sticker

A sticker view, just like MeiTuXiuXiu, which can be scaled、rotated and moved with single finger or both hands.

How to import into your project

Just drag this framework to your project. Enjoy it!

How to use it

you can initial the widget in Objective-C code in this way

    StickerView *sticker = [[StickerView alloc] initWithContentFrame:CGRectMake(0, 0, 150, 150) contentImage:[UIImage imageNamed:@"sticker1.png"]];
    sticker.center = self.view.center;
    sticker.enabledControl = YES;
    sticker.enabledBorder = YES;
    sticker.delegate = self;
    [self.view addSubview:sticker];

you can control the sticker's appearance like this

    
    sticker.enabledControl = YES; // enable or disable the operation buttons
    sticker.enabledBorder = YES; // show or hide the border line

you even can custom the sticker view through the delegate

    
    @protocol StickerViewDelegate <NSObject>

	@optional

	- (void)stickerViewDidTapContentView:(StickerView *)stickerView;

	- (void)stickerViewDidTapDeleteControl:(StickerView *)stickerView;

	- (UIImage *)stickerView:(StickerView *)stickerView imageForRightTopControl:(CGSize)recommendedSize;

	- (void)stickerViewDidTapRightTopControl:(StickerView *)stickerView; // Effective when resource is provided.

	- (UIImage *)stickerView:(StickerView *)stickerView imageForLeftBottomControl:(CGSize)recommendedSize;

	- (void)stickerViewDidTapLeftBottomControl:(StickerView *)stickerView; // Effective when resource is provided.

	@end
    

What does it look like

Author

Chen Kaijie

[email protected]

LICENSE

Copyright 2016 Chen Kaijie

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

   http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

single-hand-sticker's People

Contributors

chenkaijie4ever avatar

Stargazers

PR avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar Raul Studio avatar  avatar bluce avatar JZ avatar  avatar Chinsyo avatar 寒芒掠影 avatar 小码超哥 avatar BigBagFind avatar  avatar  avatar Lision avatar  avatar  avatar  avatar Eric avatar 理想吃 avatar  avatar depthlove avatar  avatar  avatar Mihir Gurjar avatar  avatar  avatar Sui Lei avatar sly avatar Jarvi avatar 江易疯先森 avatar jinke avatar Larry Mickie avatar  avatar Kien Lhi avatar  avatar Nadiia Berehova avatar  avatar Roy Wang avatar Pablo Pasqualino avatar aKer avatar Teena Nath Paul avatar Nonecy avatar  avatar

Watchers

 avatar Andy yan avatar  avatar  avatar

single-hand-sticker's Issues

Stickers ain't shown

Hello...
I just used this Single-hand-Sticker in my project and I rewrote into Swift.
The problem is stickers are not shown whenever application is loaded without any error.
Here are my lines of code.

 let sticker1 = StickerView();
        sticker1.delegate = self;
        sticker1.frame = CGRect(x: 0, y: 0, width: 150, height: 150);
        sticker1.contentImage = UIImage(named: "sticker1.png");
        sticker1.center = self.view.center;
        sticker1.enabledBorder = true;
        sticker1.enabledControl = true;
        self.view.addSubview(sticker1);

cant move sticker when put into custom view

hi i tried to put sticker in a custom uiview and uiimageview but the sticker stuck.cant move or scale. any idea to make this happened?

@IBOutlet weak var stickerCanvasView: UIView!
@IBOutlet weak var bgImage: UIImageView!



var animator: UIDynamicAnimator!
var selectedSticker: StickerView!

override func viewDidLoad() {
    super.viewDidLoad()
   
   
    bgImage.backgroundColor = UIColor.flatMint
    
    animator = UIDynamicAnimator(referenceView: view)
    //let tapRecognizer = UITapGestureRecognizer(target: self, action: #selector(self.tapBackground))
    //tapRecognizer.numberOfTapsRequired = 1
    //self.view.addGestureRecognizer(tapRecognizer)
    
    let sticker = StickerView(contentFrame: CGRect(x: CGFloat(0), y: CGFloat(0), width: CGFloat(150), height: CGFloat(150)), contentImage: UIImage(named: "sticker1"))
    
    sticker?.center = bgImage.center
    
    sticker?.enabledControl = true
    sticker?.enabledBorder = true
    sticker?.delegate = self
    sticker?.tag = 1
    
    bgImage.addSubview(sticker!)

    
   

    // Do any additional setup after loading the view.
}

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.