GithubHelp home page GithubHelp logo

irons163 / irsticker-swift Goto Github PK

View Code? Open in Web Editor NEW
23.0 5.0 6.0 284 KB

A powerful sticker of iOS.

License: MIT License

Swift 95.98% Objective-C 1.87% Ruby 2.15%
sticker ios swift stickerview

irsticker-swift's Introduction

Build Status Platform

IRSticker-swift

  • IRSticker-swift is a powerful sticker for iOS.
  • See objc version in here: IRStickerr.

Features

  • Customize your stickers image.
  • Customize your sitcker functions, max to 4.
  • Default functions support:
    • Delete
    • Flip
    • Move back to center of main view
    • Scale and move

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

  • Add pod 'IRSticker-swift' in the Podfile
  • pod install

Usage

Basic

  • Add StickerView.
import IRSticker_swift

let sticker1 = IRStickerView(frame: CGRect.init(x: 0, y: 0, width: 150, height: 150), contentImage: UIImage.init(named: "sticker1.png")!)
sticker1.center = view.center
sticker1.enabledControl = false
sticker1.enabledBorder = false
sticker1.tag = 1
sticker1.delegate = self
view.addSubview(sticker1)

let sticker2 = IRStickerView(frame: CGRect.init(x: 0, y: 0, width: 200, height: 200), contentImage: UIImage.init(named: "sticker2.png")!, stickerControlViewSize: 50)
sticker2.center = view.center
sticker2.stickerMinScale = 0.7
sticker2.stickerMaxScale = 1.2
sticker2.enabledControl = false
sticker2.enabledBorder = false
sticker2.tag = 2
sticker2.delegate = self
view.addSubview(sticker2)

let sticker3 = IRStickerView(frame: CGRect.init(x: 0, y: 0, width: 250, height: 250), contentImage: UIImage.init(named: "sticker3.png")!)
sticker3.center = view.center
sticker3.stickerMinScale = 0
sticker3.stickerMaxScale = 0
sticker3.enabledControl = false
sticker3.enabledBorder = false
sticker3.tag = 3
sticker3.delegate = self
view.addSubview(sticker3)
  • Disable scale limits completely when set stickerMinScale and stickerMaxScale to 0.
sticker.stickerMinScale = 0
sticker.stickerMaxScale = 0
  • Use IRStickerViewDelegate, see in the demo project.
public protocol IRStickerViewDelegate: NSObjectProtocol {
    func ir_StickerViewDidTapContentView(stickerView: IRStickerView)

    func ir_StickerView(stickerView: IRStickerView, imageForLeftTopControl recommendedSize: CGSize) -> UIImage?

    func ir_StickerViewDidTapLeftTopControl(stickerView: IRStickerView) // Effective when image is provided.

    func ir_StickerView(stickerView: IRStickerView, imageForRightTopControl recommendedSize: CGSize) -> UIImage?

    func ir_StickerViewDidTapRightTopControl(stickerView: IRStickerView) // Effective when image is provided.

    func ir_StickerView(stickerView: IRStickerView, imageForLeftBottomControl recommendedSize: CGSize) -> UIImage?

    func ir_StickerViewDidTapLeftBottomControl(stickerView: IRStickerView) // Effective when image is provided.

    func ir_StickerView(stickerView: IRStickerView, imageForRightBottomControl recommendedSize: CGSize) -> UIImage?

    func ir_StickerViewDidTapRightBottomControl(stickerView: IRStickerView) // Effective when image is provided.
}

Screenshots

Stickers After effections
Demo Passcode Settings

Copyright

This project is inspired from Single-hand-Sticker.

irsticker-swift's People

Stargazers

 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

irsticker-swift's Issues

Min/max scale is hard coded

It would be nice to be able to alter these values during the initialization:

let kStickerMinScale: CGFloat = 0.5
let kStickerMaxScale: CGFloat = 2.0

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.