loregr / lgbutton Goto Github PK
View Code? Open in Web Editor NEWA fully customisable subclass of the native UIControl which allows you to create beautiful buttons without writing any line of code.
License: MIT License
A fully customisable subclass of the native UIControl which allows you to create beautiful buttons without writing any line of code.
License: MIT License
I only see left and right icon setup. I would like to add the icon to the center of the button how can i do that thank you.
Hello,
I was just going to send a pull request for updating to swift 4.2 but i noticed the source code is on swift 4.2 only the update hasn't been delivered to cocoapods. So if you could, please bump your version with new changes you have already made.
Thanks in advance
A lot of AutoLayout errors show up after adding LGButton to a view hierarchy which had no AutoLayout errors or warnings before, and even in a setup with only one single button as unique subview
Is there anyway to force the title label to use adjustFontToFitWidth if it doesn't fit in the space? Would like the icon(s) to take priority, then the font size decreases based on how much space is left for the text label
Hello,
Have some errors when compiler with swift 4.0.
Is it possible to have a statically defined width (or one constrained by autolayout) and have the title and icon/image centered in the middle of the button? Right now, it looks like if I use autolayout or statically define a button size, that the title and icon will be aligned to the button edges.
Hi, i was designing a view in the story board when I opened again XCode all the Buttons, are not visible. They are still there, but I can´t view then in the Storyboard.
I was just wondering how to left align the content of the button, I can not get it working. This is the code I am using, with auto layout constaints to fill the button to a set width.
let test: LGButton = {
let lg = LGButton()
lg.leftIconFontName = "io"
lg.leftIconColor = UIColor.brandWhite
lg.leftIconString = "social-youtube"
lg.titleFontName = "AvenirNext-Bold"
lg.leftIconFontSize = 18
lg.titleFontSize = 18
lg.cornerRadius = 16
lg.titleString = "Show video"
return lg
}()
As you can see in the image below, the title is right aligning and if I set the spacingLeading
or the spacingTrailing
the all the content just centres when I would like it to be left aligned.
I am aiming for it to look like this (Have not set the right font sizes or colours yet):
can you possibly add some button preset on future release
Have you tried using WOFF2 assets instead of TTF/OTF ? File-size is reduced greatly (asset folder goes from 897KB to 282KB)
There's no real info about official support other than the announcement in Safari's patch notes (WOFF2 works in iOS >= 10). Adding support for WOFF2 (with WOFF fallback for earlier iOS versions) is quite simple since it only required modifying a single line of code
Maybe push it as a new sub-spec ?
Since Xcode 9.3 I get rendering errors with LGButton and that even makes most of my views invisible in Storyboard! Here is the error:
error: IB Designables: Failed to render and update auto layout status: dlopen(LGButton.framework, 1): no suitable image found. Did find:
LGButton.framework: required code signature missing for 'LGButton.framework'
I create LGButton IBAction method, But not performing any action which, if your hold that button form a minute then it perform IBAction function.
It happen in one touch like normal button
A lot of errors in pod files. SwiftIconFont.Swift and Fontloader.swift have some error
Why is the intrinsicContentSize, 10x10?
Describe the bug
#33
To Reproduce
Steps to reproduce the behavior:
Round a button fully
add a white border
voila
the circle has a black very thin border
This is the same issue reported in issue 33, was this resolved?
Awesome and thanks for work. We need only bottom border to button, is this feature already available or we need to make ?
simple,
when Transparent BG & white border. it will show white BG...
When I put a left icon (string:camera, font: io) and a title string, they are both at the opposite of the UIView. Icon is at the extreme left and text at the extreme right. Setting "Spacing title icon" doesn't allow me to bring them closer, only "Spacing leading" and "Spacing trailing" change something.
PS: My LGButton is in a stackview with trailing constraints.
Or do I have to assign tap gesture for it?
Thanks
In addition to CocoaPods I think Carthage support would be nice to have.
I might have time to help implement this in the future, but submitting an issue now in case someone feels up to the task.
Carthage info: https://github.com/Carthage/Carthage
I think the only thing that needs to be changed is making the schemes for building the framework 'shared'.
Releases are already tagged according to SemVer, which Carthage will respect automatically, so that is already done.
I'm trying to make the font size of the title bold, but don't see how to do it in the code.
Is there a way to make the button background transparent or non-opaque with alpha component less than 1? I pulled an IBOutlet into my VC as a UIView
and attempted to set the backgroundColor
to dark gray with alpha component 0.25 but that doesn't seem to work. Is it even possible?
Here's my code
@IBOutlet weak var cameraButton: UIView!
cameraButton.isOpaque = false
cameraButton.backgroundColor = UIColor.darkGray.withAlphaComponent(0.25)
Hi,
It is possible to make a multiline title?
Thank you.
Describe the bug
If we have a cell with an LGButton and set isLoading to true, the activityIndicator shows up but doesn't spin.
To Reproduce
Steps to reproduce the behavior:
Expected behavior
indicator should spin
Additional context
Probably related to this: https://stackoverflow.com/questions/28737772/uiactivityindicatorview-stops-animating-in-uitableviewcell
xibSeup is called twice, first from init then later from awakeFromNib, resulting in the rootView being added twice to the view hierarchy.
how to add myself iconfont?
thanks for your pod.
I use it in my app but when I want change button title by this code:
buyBtn.titleString = "play"
buyBtn is outlet from lgButton that I use in my view controller
but app crash with this error :
Thread 1: Fatal error: Unexpectedly found nil while implicitly unwrapping an Optional value
Describe the bug
Is anyone else experiencing really long archive times for LGBUtton? I'm using v1.1.6 of the library, and this issue exists with v1.1.5 as well. I thought upgrading Xcode from 10.2 to 10.2.1 would fix it, as I assumed it was a bug with the Swift compiler, but the issue persists.
This only happens during the archive phase, with device set to "Generic iOS Device". And does not happen when simply building for a device
To Reproduce
Steps to reproduce the behavior:
Expected behavior
Archive should not take long to archive the LGButton library. This is not a project or app specific issue, as I experienced this in a brand new project.
Desktop (please complete the following information):
Smartphone (please complete the following information):
Additional context
Add any other context about the problem here.
platform :ios, '12.0'
use_frameworks!
# ignore all warnings from all pods
inhibit_all_warnings!
target 'Testing' do
pod 'LGButton'
end
For example, we need to patch some handy instance functions for the button, I would naturally think we can subclass it, then we can use the shared handy function everywhere, and make UI configs consistent
sth like:
clsss CustomButton: LGButton {
init(withButtonTitle){
super.init()
// custom config
// ....
}
func enableButton() {
self.isEabled = true
// other custom UI change to enabled button
// ...
}
func disableButton() {
// counterpart to enableButton.
}
//.. other functions needed per custom requirements
}
fontURL is nil (FontAwesome.ttf file no longer found in the resources folder) causing FontLoader.swift to crash at line 26: let data = try Data(contentsOf: fontURL!)
Can you make it so that we can define what the button will look like when its disabled?
Right now the enabled and disabled button look extremely simular.
In IonIcons.swift are a lot of strings to Icon Font Codes.
How can I preview or see what Icon those are?
After updating from 1.0.5 to 1.1.1, I need to hold the button to receive the IBAction in my view controller instead of just tap the button. I tested some things and found that if you remove the "if" of line 708 of file "LGButton.swift" (based on commit 3dfd991), the problem will no longer exists.
I am new to ios i want to use this library for to create facebook button using this pod.
I am not able to create that
please explain how can i do this task
Is it possible to configure centered vertical button?
When I set it up the image goes to the top and the text goes to the bottom.
Is there any way I can set the font weight of the title text?
Describe the bug
Depending on a flag, I want to change the gradient colors (Or, background color) of an LGButton. But, we cannot change the colors runtime from whatever the colors the button is initially initiated with or given on storyboard.
To Reproduce
Steps to reproduce the behavior:
UIView
onto any UIViewController
's UIView
or another UIView
.LGButton
and assign an IBOutlet
lgButton
.if status == true {
lgButton.gradientStartColor = .red
lgButton.gradientEndColor = .green
} else {
lgButton.gradientStartColor = .gray
lgButton.gradientEndColor = .white
}
Smartphone (please complete the following information):
iOS 12, 11
Add here your question
just find out there is version 1.1.5 to fix some touch bugs. which are present in my project
how can i update to 1.1.5
This is a popular dependency manager, many use it. You have a good library, it is a pity that it does not yet support installation via Carthage.
I use an IBAction with event "Touched up inside" and my view controller has also a UITapGestureRecognizer. When I touch my button the IBAction is not called because the tap gesture prevail. That is not the case with a UIButton.
I found that some UIControl functions setting the Hilighted property are override in the LGButton class and that is not the case in UIButton class.
The solution I used is to use my view controller as a delegate of my gesture recognizer and to check if the location of the tap is inside my button bounds.
Describe the bug
Aftet update to last version, i can't add gesture recognizer in referenced buttons.
To Reproduce
override func viewDidLoad() {
///..
let tap = UITapGestureRecognizer(target: self, action: #selector(self.handleButton))
self.button.addGestureRecognizer(tap)
self.button.isUserInteractionEnabled = true
///..
}
@objc func handleButton() {
self.dismiss(animated: true, completion: nil)
}
Expected behavior
I need add touch button action from code because is dynamic.
Smartphone (please complete the following information):
It would be nice if we can also set NSAttributedString as button title. In one of my project, I created all buttons programmatically and wanted to set NSAttributedString for some of them.
When I clicked on the button , the icon became large when button is active. Is there a way to disable it ?
The default background color should be clear but it's between dark grey and light grey for me.
Plus, when the view is charging at beginning we can see it grey instead of the chosen color (I'm using Storyboard).
Added to pod as
pod 'LGButton'
But keep getting this error upon pod install
[!] Unable to find a specification for 'LGButton'
Swift 3, Xcode 8
How do I get the updated google plus icon from font awesome? When I set the corresponding values to fa and google-plus-g, I don't see the updated Google Plus.
Any help would be much appreciated! Thanks!
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.