Giter Site home page Giter Site logo

makehui / mhwhiteboard Goto Github PK

View Code? Open in Web Editor NEW
6.0 2.0 1.0 82 KB

A simple whiteboard library, based on UIView. (一个简洁的白板库, 基于UIView)

License: MIT License

Objective-C 100.00%
whiteboard sketchpad ios objective-c whiteboard-library uiview xcode carthage

mhwhiteboard's Introduction

MHWhiteboard

A simple whiteboard library, based on UIView. (一个简洁的白板库, 基于UIView)

Features

  • line (线条)
  • straight line (直线)
  • circle (圆)
  • rectangle (矩形)
  • polygon (正多边形)
  • foreground image (前景图片)
  • background image (背景图图片)
  • text (文字)
  • undo (撤销)
  • repeat (回撤)

Requirements

  • iOS 8.0+
  • Xcode 9.0+

Installation

Carthage

Carthage is a decentralized dependency manager that builds your dependencies and provides you with binary frameworks.

You can install Carthage with Homebrew using the following command:

$ brew update
$ brew install carthage

To integrate MHWhiteboard into your Xcode project using Carthage, specify it in your Cartfile:

github "MakeHui/MHWhiteboard"

Run carthage update to build the framework and drag the built MHWhiteboard.xcodeproj into your Xcode project.

Usage

#import <MHWhiteboard/MHWhiteboard.h>

MHWhiteboardView *whiteboardView = [[MHWhiteboardView alloc] initWithFrame:CGRectMake(0, 0, 375, 500)];

[whiteboardView setBrushColor:[UIColor redColor]];	// 设置画笔颜色
[whiteboardView setBrushWidth:10.0f];	// 设置画笔宽度
[whiteboardView setForegroundImage:[UIImage new]];	// 设置前景图片
[whiteboardView setBackgroundImage:[UIImage new]];	// 设置背景图片
[whiteboardView undo];	// 撤销
[whiteboardView repeat]; // 回撤
[whiteboardView clearBackgroundImage];	// 清除背景图片
[whiteboardView clearAll];	// 清空白板

// Set current tool
typedef NS_OPTIONS(NSUInteger, MHPathModelAction) {
    MHPathModelActionLine = 1 << 16,
    MHPathModelActionStraightLine = 1 << 17,
    MHPathModelActionCircle = 1 << 18,
    MHPathModelActionRectangle = 1 << 19,
    MHPathModelActionPolygon = 1 << 20,
    MHPathModelActionText = 1 << 21,
    // MHPathModelActionSmear = 1 << 22,
    // MHPathModelActionMosaic = 1 << 23,
};

whiteboardView.pathModelAction = MHPathModelAction;

License

MHWhiteboard is released under the MIT license. See LICENSE for details.

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.