pavelkatunin / downloadbutton Goto Github PK
View Code? Open in Web Editor NEWCustomizable App Store style download button
Home Page: http://pavelkatunin.github.io/DownloadButton
License: Other
Customizable App Store style download button
Home Page: http://pavelkatunin.github.io/DownloadButton
License: Other
I think the podspec file is not set correctly. It targets iOS and 7.0 only. I think it should have the greater than or equal to 7.0 in the podspec so it can support all versions.
I currently get an error when trying to add it to my project.
[!] Unable to satisfy the following requirements:
My Podfile targets 7.1 and up.
I find the default color of the empty line is gray, and I want to change it to red. and implement the following code.
self.btnDownload.stopDownloadButton.tintColor = UIColor.red
But it does not work, it only makes the filledLine color changed.
Who knows how to change the color of empty line?
Could you add Swift Example Code ?
to make me understand how to use it in swift .
Thank you
kPKDownloadButtonState_Pending for PKDownloadButton state not rotating.
Hi,
after I upgraded from 6866d4d to ff72143, my app started crashing. I discovered that it is due to me setting attributedTitle of the startDownloadButton to nil
, and this code thus initializing an NSAttributedString
with a nil
string.
I think the solution is quite easy - in [PKDownloadButton updateButton:title:]
, check if the passed title
is nil
. If yes, initialize attrTitle
itself as nil
.
Needs to be tested.
I have review the code in the Classes file.didn't seen any api is only for ios SDK version 8.0 or later.
can you tell me Requires iOS SDK version > 8.0.
PS:my app need support ios sdk version >=7.0.
thanks.
Hello,
I am not able to see the progress. I am just able to see the circle with stop button but no progress even though the app is downloading the content. I have manually added classes from the Download button folder under the Example app. Below is the relevant code:
if (self.progress.fractionCompleted > 0){
DLog(@"***** %f",self.progress.fractionCompleted);
self.downloadProgress.stopDownloadButton.progress = self.progress.fractionCompleted;
}
When I tried to compile it on Xcode 8, the compiling fails, and here is the error description:
CodeSign /Users/xxx/Library/Developer/Xcode/DerivedData/YYY-devhhrztnwiafzdnbmqgugeublld/Build/Products/Debug-iphonesimulator/DownloadButton.bundle
cd /Users/ydong/Documents/codebase/YYY/YYY/Pods
export CODESIGN_ALLOCATE=/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/codesign_allocate
export PATH="/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin:/Applications/Xcode.app/Contents/Developer/usr/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin"Signing Identity: "-"
/usr/bin/codesign --force --sign - --timestamp=none /Users/xxx/Library/Developer/Xcode/DerivedData/YYY-devhhrztnwiafzdnbmqgugeublld/Build/Products/Debug-iphonesimulator/DownloadButton.bundle
/Users/xxx/Library/Developer/Xcode/DerivedData/YYY-devhhrztnwiafzdnbmqgugeublld/Build/Products/Debug-iphonesimulator/DownloadButton.bundle: bundle format unrecognized, invalid, or unsuitable
Command /usr/bin/codesign failed with exit code 1
Does anyone knows what's the going wrong?
In UIButton+PKDownloadButton.m
, the -tintColorDidChange
method is reimplemented. This replaced the default implementation of the said method, and makes all UIButtons without a custom -tintColorDidChange
to gain the rounded border whenever their tintColor
is changed.
It is better to create a UIButton subclass for the "startDownloadButton" and "downloadedButton" and override -tintColorDidChange
in the subclass to avoid the global effect.
The project lacks an actual framework target so that it can be linked dynamically to apps and app extensions. "CocoaPods only" distribution makes this code hard to use by developers whose dependencies are dynamic frameworks.
P.S. It will be possible to use this code with Carthage package manager
Just added DownloadButton to my project. Have to say, it is great. Thank you, Pavel, for this awesome soluton! But still there are some things, I'd like to ask:
UIImage+PKDownloadButton
in Swift? When I try customising the button as in the example (calling UIImage initialiser with method buttonBackgroundWithColor
), that initialiser in unaccessible. (I add DownloadButton as accessoryView to my UITableViewCell
in cellForRowAtIndex
method)UITableViewController
class, when I implement PKDownloadButtonDelegate
, downloadButtonTapped
method is never called when I tap the button. (I have a button in each row of my tableView). How should I properly implement it?Sorry for the very long text, but I think this would be useful for many beginnes, like me
Thank you in advance.
Hi,
Thanks for this awesome component.
I have a situation where I have added a DownloadButton to each row of a UITableView. Imagine I tap on one of them and a download starts and the button gets updated when the download progresses. Now If I scroll, the cells get reused. How can I restore the state of each DownloadButton? (Showing download progress to be exact)
Hey,
So I added your button to my table view in IB and created an IB outlet but when I try changing the start download title in viewDidLoad
, nothing happens at all.
downloadButton.startDownloadButton.setTitle("Hello", forState: .Normal)
downloadButton.startDownloadButton.titleLabel?.text = "GET"
I have tried [self.downloadButton.startDownloadButton.titleLabel setFont: [UIFont systemFontOfSize: 14]];
but it's not working
2018-05-28 20:04:20.696946+0800 DownloadButton_Example[22493:1707307] +[CATransaction synchronize] called within transaction
2018-05-28 20:04:21.066380+0800 DownloadButton_Example[22493:1707307] [LayoutConstraints] Unable to simultaneously satisfy constraints.
Probably at least one of the constraints in the following list is one you don't want.
Try this:
(1) look at each constraint and try to figure out which you don't expect;
(2) find the code that added the unwanted constraint or constraints and fix it.
(
"<NSLayoutConstraint:0x60400028d4d0 PKCircleView:0x7fe842d1c7a0.width == 0 (active)>",
"<NSLayoutConstraint:0x60400028d750 H:|-(0)-[PKCircleView:0x7fe842d1c7a0] (active, names: '|':PKStopDownloadButton:0x7fe842d1b980 )>",
"<NSLayoutConstraint:0x60400028d7a0 H:[PKCircleView:0x7fe842d1c7a0]-(0)-| (active, names: '|':PKStopDownloadButton:0x7fe842d1b980 )>",
"<NSLayoutConstraint:0x60000028a5f0 PKDownloadButton:0x7fe842c0d800.width == 93 (active)>",
"<NSLayoutConstraint:0x60000028a730 H:|-(0)-[PKStopDownloadButton:0x7fe842d1b980] (active, names: '|':PKDownloadButton:0x7fe842c0d800 )>",
"<NSLayoutConstraint:0x60000028a780 H:[PKStopDownloadButton:0x7fe842d1b980]-(0)-| (active, names: '|':PKDownloadButton:0x7fe842c0d800 )>"
)
Will attempt to recover by breaking constraint
<NSLayoutConstraint:0x60400028d4d0 PKCircleView:0x7fe842d1c7a0.width == 0 (active)>
Make a symbolic breakpoint at UIViewAlertForUnsatisfiableConstraints to catch this in the debugger.
The methods in the UIConstraintBasedLayoutDebugging category on UIView listed in <UIKit/UIView.h> may also be helpful.
2018-05-28 20:04:21.070967+0800 DownloadButton_Example[22493:1707307] [LayoutConstraints] Unable to simultaneously satisfy constraints.
Probably at least one of the constraints in the following list is one you don't want.
Try this:
(1) look at each constraint and try to figure out which you don't expect;
(2) find the code that added the unwanted constraint or constraints and fix it.
(
"<NSLayoutConstraint:0x60400028d520 PKCircleView:0x7fe842d1c7a0.height == 0 (active)>",
"<NSLayoutConstraint:0x60400028d7f0 V:|-(0)-[PKCircleView:0x7fe842d1c7a0] (active, names: '|':PKStopDownloadButton:0x7fe842d1b980 )>",
"<NSLayoutConstraint:0x60400028d840 V:[PKCircleView:0x7fe842d1c7a0]-(0)-| (active, names: '|':PKStopDownloadButton:0x7fe842d1b980 )>",
"<NSLayoutConstraint:0x60000028a460 PKDownloadButton:0x7fe842c0d800.height == 30 (active)>",
"<NSLayoutConstraint:0x60000028a7d0 V:|-(0)-[PKStopDownloadButton:0x7fe842d1b980] (active, names: '|':PKDownloadButton:0x7fe842c0d800 )>",
"<NSLayoutConstraint:0x60000028a820 V:[PKStopDownloadButton:0x7fe842d1b980]-(0)-| (active, names: '|':PKDownloadButton:0x7fe842c0d800 )>"
)
Will attempt to recover by breaking constraint
<NSLayoutConstraint:0x60400028d520 PKCircleView:0x7fe842d1c7a0.height == 0 (active)>
Make a symbolic breakpoint at UIViewAlertForUnsatisfiableConstraints to catch this in the debugger.
The methods in the UIConstraintBasedLayoutDebugging category on UIView listed in <UIKit/UIView.h> may also be helpful.
2018-05-28 20:04:21.072207+0800 DownloadButton_Example[22493:1707307] [LayoutConstraints] Unable to simultaneously satisfy constraints.
Probably at least one of the constraints in the following list is one you don't want.
Try this:
(1) look at each constraint and try to figure out which you don't expect;
(2) find the code that added the unwanted constraint or constraints and fix it.
(
"<NSLayoutConstraint:0x60400028de30 PKCircleView:0x7fe842d20e40.width == 26 (active)>",
"<NSLayoutConstraint:0x60400028de80 H:|-(0)-[PKCircleView:0x7fe842d20e40] (active, names: '|':PKPendingView:0x7fe842d202e0 )>",
"<NSLayoutConstraint:0x600000289f60 H:[PKCircleView:0x7fe842d20e40]-(0)-| (active, names: '|':PKPendingView:0x7fe842d202e0 )>",
"<NSLayoutConstraint:0x60000028a5f0 PKDownloadButton:0x7fe842c0d800.width == 93 (active)>",
"<NSLayoutConstraint:0x60000028a9b0 H:|-(0)-[PKPendingView:0x7fe842d202e0] (active, names: '|':PKDownloadButton:0x7fe842c0d800 )>",
"<NSLayoutConstraint:0x60000028aa00 H:[PKPendingView:0x7fe842d202e0]-(0)-| (active, names: '|':PKDownloadButton:0x7fe842c0d800 )>"
)
Will attempt to recover by breaking constraint
<NSLayoutConstraint:0x60400028de30 PKCircleView:0x7fe842d20e40.width == 26 (active)>
Make a symbolic breakpoint at UIViewAlertForUnsatisfiableConstraints to catch this in the debugger.
The methods in the UIConstraintBasedLayoutDebugging category on UIView listed in <UIKit/UIView.h> may also be helpful.
2018-05-28 20:04:21.073154+0800 DownloadButton_Example[22493:1707307] [LayoutConstraints] Unable to simultaneously satisfy constraints.
Probably at least one of the constraints in the following list is one you don't want.
Try this:
(1) look at each constraint and try to figure out which you don't expect;
(2) find the code that added the unwanted constraint or constraints and fix it.
(
"<NSLayoutConstraint:0x60400028dde0 PKCircleView:0x7fe842d20e40.height == 26 (active)>",
"<NSLayoutConstraint:0x600000283a70 V:|-(0)-[PKCircleView:0x7fe842d20e40] (active, names: '|':PKPendingView:0x7fe842d202e0 )>",
"<NSLayoutConstraint:0x600000289a10 V:[PKCircleView:0x7fe842d20e40]-(0)-| (active, names: '|':PKPendingView:0x7fe842d202e0 )>",
"<NSLayoutConstraint:0x60000028a460 PKDownloadButton:0x7fe842c0d800.height == 30 (active)>",
"<NSLayoutConstraint:0x60000028aa50 V:|-(0)-[PKPendingView:0x7fe842d202e0] (active, names: '|':PKDownloadButton:0x7fe842c0d800 )>",
"<NSLayoutConstraint:0x60000028aaa0 V:[PKPendingView:0x7fe842d202e0]-(0)-| (active, names: '|':PKDownloadButton:0x7fe842c0d800 )>"
)
Will attempt to recover by breaking constraint
<NSLayoutConstraint:0x60400028dde0 PKCircleView:0x7fe842d20e40.height == 26 (active)>
Make a symbolic breakpoint at UIViewAlertForUnsatisfiableConstraints to catch this in the debugger.
The methods in the UIConstraintBasedLayoutDebugging category on UIView listed in <UIKit/UIView.h> may also be helpful.
Hi,
I m trying to set the progress to the stopDownloadButton
in a NSURLSessionDownloadTask
. I see the stopDownloadButton, but the progress is not increasing. Here is my block:
progress:^(NSProgress * _Nonnull downloadProgress) {
self.downloadButton.stopDownloadButton.progress = downloadProgress.fractionCompleted;
}
What am I doing wrong?
Thanks in advance,
I use this lib in swift, and add some constraints for PKDownloadButton, but I find the side of stopDownloadButton is not changed.
Who knows some way to change the size of stopDownloadButton?
Thanks
Is there any reason support for iOS 7 can't be added? It would be helpful since the button changes were made back in 7 and continue in 8.
Hi PK,
I'm using PKDownloadButton within table view cells, at first those buttons are good and the delegate get called perfectly, but I observed that if a PKDownloadButton is reused, it won't animate anymore. Am I doing anything wrong? Is there any work around for it? Thank you!
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.