Coder Social home page Coder Social logo

bubblelayer's Introduction

Bubble Layer

用于将一个view做成“气泡”的样式,效果如下图所示:

使用方法

BubbleLayer.hBubbleLayer.m两个文件导入你的工程,然后在使用的地方import头文件。如果是Swift工程,可以直接导入BubbleLayer.swift

下面是一个使用Objective-C的例子:

BubbleLayer *bbLayer = [[BubbleLayer alloc]initWithSize:myView.bounds.size];

// 矩形框的圆角半径
bbLayer.cornerRadius = 20;

// 凸起那部分暂且称之为“箭头”,下面的参数设置它的形状
bbLayer.arrowDirection = ArrowDirectionLeft;
bbLayer.arrowHeight = 22;   // 箭头的高度(长度)
bbLayer.arrowWidth = 30;    // 箭头的宽度
bbLayer.arrowPosition = 0.5;// 箭头的相对位置
bbLayer.arrowRadius = 3;    // 箭头处的圆角半径

[myView.layer setMask:[bbLayer layer]];

Demo

如果不太清楚的参数的含义,可以通过使用Demo理解。

bubblelayer's People

Contributors

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