Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up

A fully customisable subclass of the native UIControl which allows you to create beautiful buttons without writing any line of code.

License

NotificationsYou must be signed in to change notification settings

loregr/LGButton

Repository files navigation

logo

buildplatformlicenseVersion

A fully customisable subclass of the nativeUIControl which allows you to create beautiful buttons without writing any line of code.

Preview

You'll be able to create buttons like these by using only the interface builder:

preview

Moreover you can use them for asynchronous operations.

async

Install

To integrateLGButton into your Xcode project using CocoaPods, specify it in yourPodfile:

use_frameworks!pod'LGButton'

Icons and images

You can add images/icons to your button, icons are taken from different ready to use font icons collections, images can be imported directly from your project assets folder.

You can customise icons/images on the left and/or on the right of the button title.

Icons

Icons are managed bySwiftIconFont integration, so you can easily add and customise button icons by choosing from the most popular font icons collections. In particular:

CollectionFont nameCheat Sheet
Font AwesomefaList
Ion IconsioList
OcticonsocList
Open IconicicList
Material IconmaList
ThemifytiList
Map IconsmiList

The main properties that you need to set in order to use font icons are:

  • Icon Font Name: you can pick one value from the table above, different values will be ignored(please consider that not all the icons may be available since this library may not be updated right after a font library update).

  • Icon String: the icon name taken from the cheatsheet without the collection prefix.

So, if you want to usefa-align-left fromFont Awesome,Icon Font Name will befa andIcon String will bealign-left.

Images

Set theImage source property in order to use an image from your assets folder.

Note: ifImage source is set, every other property about the font icon on the same side will be ignored.

Usage

Drag and drop anUIView object into your view controller and set its class and module toLGButton.

class

Customise your button by setting the properties from the Interface Builder.

properties_1properties_2

Supported Attributes

AttributeDescriptionDefault value
Bg ColorMain background colorclear
Show Touch FeedbackWhether a touch feedback should be visible or nottrue
Gradient Start ColorThe first color of the gradient backgroundnil
Gradient End ColorThe second color of the gradient backgroundnil
Gradient End ColorThe second color of the gradient backgroundnil
Gradient HorizontalWhether the gradient should be horizontal or notfalse
Gradient RotationSet the gradient rotation angle (degrees from -360 to 360)0
Corner RadiusThe corner radius0.0
Fully Rounded CornersApply a corner radius equals to height/2false
Border ColorThe border colorwhite
Border WidthThe border width0.0
Title ColorThe title colorwhite
Title StringThe title stringEMPTY_STRING
Title Font NameThe title font namenil
Title Font SizeThe title font size14.0
Vertical orientationIftrue the left icon will be placed on the top and the right icon will be placed on the bottomfalse
Left Icon StringThe name of the left icon (taken from the cheat sheet)EMPTY_STRING
Left Icon Font NameThe name of the left icon font name (taken from the table above)EMPTY_STRING
Left Icon Font SizeThe left icon font size14.0
Left Icon ColorThe left icon colorwhite
Left Image SrcThe name of the left source assetnil
Left Image HeightThe left image height20.0
Left Image WidthThe left image width20.0
Left Image ColorThe left image tint colornil
Right Icon StringThe name of the right icon (taken from the cheat sheet)EMPTY_STRING
Right Icon Font NameThe name of the right icon font name (taken from the table above)EMPTY_STRING
Right Icon Font SizeThe right icon font size14.0
Right Icon ColorThe right icon colorwhite
Right Image SrcThe name of the right source assetnil
Right Image HeightThe right image height20.0
Right Image WidthThe right image width20.0
Right Image ColorThe right image tint colornil
Spacing Title IconThe spacing between the title and the image/icon16.0
Spacing TopThe internal top spacing8.0
Spacing BottomThe internal bottom spacing8.0
Spacing LeadingThe internal leading spacing16.0
Spacing TrailingThe internal trailing spacing16.0
Shadow OffsetThe shadow offset(0,0)
Shadow RadiusThe shadow radius0.0
Shadow OpacityThe shadow opacity1.0
Shadow ColorThe shadow colorblack
Loading spinner ColorThe loading spinner colorwhite
Loading StringThe loading message textEMPTY_STRING
Loading Font NameThe loading message font nameEMPTY_STRING
Loading Font SizeThe loading message font size14.0
Left Alignedtrue if the button items should be aligned to the left. It requires the button to have a fixed widthfalse
Right Alignedtrue if the button items should be aligned to the right. It requires the button to have a fixed widthfalse

You can download the demo project if you want to check more.

Issues

Feel free to submit issues and features requests.

Contributing

Contributions are more then welcome. Your contribution may include bug fixing or/and new features.

Please follow the "fork-and-pull" Git workflow (checkhere for more).

  1. Fork the repo on GitHub
  2. Clone the project to your own machine
  3. Commit changes to your own branch
  4. Push your work back up to your fork
  5. Submit aPull request so that I can review your changes

NOTE: Be sure to merge the latest from "upstream" before making a pull request!

Author

Lorenzo Greco

Credits

SwiftIconFont project is used in order to provide ready to use icons.

License

MIT LicenseCopyright (c) 2017 Lorenzo GrecoPermission is hereby granted, free of charge, to any person obtaining a copyof this software and associated documentation files (the "Software"), to dealin the Software without restriction, including without limitation the rightsto use, copy, modify, merge, publish, distribute, sublicense, and/or sellcopies of the Software, and to permit persons to whom the Software isfurnished to do so, subject to the following conditions:The above copyright notice and this permission notice shall be included in allcopies or substantial portions of the Software.THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS ORIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THEAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHERLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THESOFTWARE.

About

A fully customisable subclass of the native UIControl which allows you to create beautiful buttons without writing any line of code.

Topics

Resources

License

Code of conduct

Stars

Watchers

Forks

Packages

No packages published

Languages


[8]ページ先頭

©2009-2025 Movatter.jp