Coder Social home page Coder Social logo

nbomberger / mgdrawingslate Goto Github PK

View Code? Open in Web Editor NEW

This project forked from gtmtg/mgdrawingslate

0.0 2.0 0.0 156 KB

Simple, customizable, and easy-to-use UIView subclass that allows developers to easily embed a drawing view within their app.

Home Page: mgapps.weebly.com

License: MIT License

mgdrawingslate's Introduction

#MGDrawingSlate

##Introduction MGDrawingSlate is a simple, customizable, and easy-to-use UIView subclass that allows developers to easily embed a drawing view within their app. It is based on this tutorial but includes several enhancements, and utilizes a UIBezierPath to create a smooth path that follows the user's finger movements on the drawing slate. This implementation allows for a great deal of customizability, allowing developers (and, by extension, users) to easily change the drawing color, thickness, etc. Download it and give it a try!

##Usage Simply copy MGDrawingSlate.h and MGDrawingSlate.m to your project. Then, in the view controller in which you want to embed the drawing slate, add import MGDrawingSlate.h.

To create the MGDrawingSlate, use

MGDrawingSlate *drawingSlate = [[MGDrawingSlate alloc] initWithFrame:CGRectMake(x, y, width, height)];
[drawingSlate addToSubview];

Alternatively, if you would prefer to position and size the drawing slate in Interface Builder itself, just create a placeholder view. In your viewDidLoad method, get the frame of the placeholder view, remove it from the superview, and initialize the MGDrawingSlate with that frame instead.

In addition, you can do several other things with the the MGDrawingSlate, like clear it and export the drawing to the user's camera roll. See the included demo application and its source code for ways to implement these.

##Customization Because the MGDrawingSlate uses a UIBezierPath, it offers a lot of customizability right out of the box. In addition, MGDrawingSlate includes methods that make it easier to customize frequently-modified properties of the drawing path, namely the color and the line weight. To change the color, use

[drawingSlate changeColorTo:whateverUIColorYouWant];

and to change the line weight, use:

[drawingSlate changeLineWeightTo:whateverIntegerYouWant];

Of course, you can also change any properties of the drawing slate's drawingPath directly. Just use

drawingSlate->drawingPath.propertyToChange = desiredValue;

See the UIBezierPath documentation for more information on the properties you can change.

##License and Copyright MGDrawingSlate is open-source and is licensed under the MIT License. To put it simply, this means that you can use it in both free and commercial work with a few conditions. For more information, see the license file included with this source code or visit http://opensource.org/licenses/MIT.

MGDrawingSlate is © 2012 MG App Development. Some rights reserved. See the license file or visit the link above for more information.

##Other Information The demo application included with this source code is also licensed under the MIT License and is © 2012 MG App Development. In addition to MGDrawingSlate, the demo application uses the InfColorPicker, which is © 2011 InfinitApps.

mgdrawingslate's People

Watchers

Nathaniel Bomberger avatar James Cloos avatar

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.