Giter Site home page Giter Site logo

uibuttonflat's Introduction

UIButtonFlat

Summary

This extension provides the ability to easily create a UIButton with a flat style, a border or both.

To learn more about this project, please visit it on GitHub.

Demo

Give UIButtonFlat a try without having to type a single line of code with the UIButtonFlat Demo.

Installation

Simply add UIButtonFlat via Swift Package Manager to your project... that's it!

Usage

You can choose to create a UIButtonFlat control in the same way that you would create a stock UIButton control, either via Storyboards, programmatically or through a mixture of the two.

Via Storyboards

  1. Select the UIButton that you wish to use
  2. Switch to the Identity Inspector
  3. Update the UIButton's class to 'UIButtonFlat'
  4. Switch to the Attributes Inspector
  5. Switch Type to 'Custom'
  6. You can find the configuration options under the Button Flat heading

Via Code

Import UIButtonFlat. Then create a UIButtonFlat control in the same way that you would create a UIButton control, except that instead of using UIButton, use the UIButtonFlat type. Because UIButtonFlat in an extension of UIButton, all of UIButton's functions will be inherited. Please note that if you are creating a UIButtonFlat from scratch and not connecting to a button that you've either fully or partially configured in a Storyboard, you will need to declare it's type as .custom like so:

let button: UIButtonFlat = UIButtonFlat(type: .custom)

Reference

Attribute Type Default Description
flatBackground Bool false Determines if a flat background will be drawn
border Bool false Determines if a border will be drawn
borderColor UIColor .clear The color of the border
borderWidth CGFloat 1 The width of the border
corner Bool false Determines if a rounded corner will be applied
cornerRadius CGFloat 0 The radius of the corner
backgroundColor UIColor self.view.backgroundColor The color used when drawing a flat background
textColor UIColor .white The color used by the title label; overrides titleLabel.textColor

Known Issues

  • None

uibuttonflat's People

Contributors

darthxoc avatar

Watchers

 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.