Code Monkey home page Code Monkey logo

paintcode-dynamic-bezier-shapes-demo's Introduction

官方教程地址:https://www.paintcodeapp.com/examples

PaintCode能够画出各种自定义的曲线图形(再也不怕设计师的各种曲线和细节实现不了),而且很方便的集成到iOS项目中,支持Swift和Objective-C。尤其是 Dynamic Shapes 支持简单约束,可以保持大小变化时图形规则变化。

软件截图:

操作很简单,和Sketch习惯差不多。

![Screen Shot 2017-02-05 at 12.14.33](./Screen Shot/Screen Shot 2017-02-05 at 12.14.33.png)

自定义视图代码:

实现一个带有箭头的圆形边框的图片视图

import UIKit

class ButtonView: UIView {

    var image: UIImage? {
        didSet {
            if imageView == nil {
                imageView = UIImageView()
                imageView?.backgroundColor = .clear
                imageView?.layer.masksToBounds = true
                self.insertSubview(imageView!, at: 0)
            }
            imageView?.image = image
        }
    }

    private var imageView: UIImageView?

    override func draw(_ rect: CGRect) {
		// 重点代码,一行即可完成
        JLXStyleKit.drawBubbleButton(frame: self.bounds)
    }

    override func layoutSubviews() {
        super.layoutSubviews()

        imageView?.frame = CGRect(x: self.bounds.width * 0.5 / 38.0, y: self.bounds.width * 0.5 / 38.0, width: self.bounds.width * 37 / 38.0, height: self.bounds.width * 37 / 38.0)
        imageView?.layer.cornerRadius = bounds.width / 2.0
    }

}

运行截图:

![Simulator Screen Shot Feb 5, 2017, 12.16.37](./Screen Shot/Simulator Screen Shot Feb 5, 2017, 12.16.37.png)

paintcode-dynamic-bezier-shapes-demo's People

Contributors

gewill avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  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.