Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DownloadButton usage in Swift with UITableView #6

Open
smazokha opened this issue Jun 29, 2015 · 2 comments
Open

DownloadButton usage in Swift with UITableView #6

smazokha opened this issue Jun 29, 2015 · 2 comments

Comments

@smazokha
Copy link

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:

  1. How can I access 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)
  2. In 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?
  3. When I programmatically change the DownloadButton state to .Downloading and the circle comes out, how can this circle be moved to the right side of the button corner? (Now it is on the left side)
  4. Maybe this one is not about this library, but still, is it possible to implement AppStore-like cloud button with the same functions? For example, when I tap the button and the Downloading circle comes out?
  5. How can I localise DownloadButton?

Sorry for the very long text, but I think this would be useful for many beginnes, like me

Thank you in advance.

@PavelKatunin
Copy link
Owner

@stepanmazokha, Hi Stepan, thank you for the feedback! I really appreciate that. please, ask more questions if you have some.

  1. I haven't yet tried to use DownloadButton in Swift, hope I'll be able to do that soon. I will update code and post a comment here.
  2. Could you show me how do you implement cellForRowAtIndexPath method?
  3. There is a BOOL property called filledLineStyleOuter in PKCircleProgressView, you can set it YES. Please correct me if you asked about something else.
  4. I'm planing to make DownloadButton more extendable and make it possible to add states in the button. Anyway, now you can instantiate every subview and use it separately. For example you can initialize an instance of PKCircleProgressView and make some other control with it.
  5. So far you can do like this
    [downloadButton.startDownloadButton setTitle:NSLocalizedString(@"someString", @"") forState:UIControlStateNormal];

Or like this

NSAttributedString *attributedString = [[NSAttributedString alloc] initWithString:NSLocalizedString(@"someString", @"") attributes:@{......some attributes}];
[downloadButton.startDownloadButton seAttributedtTitle:attributedString forState:UIControlStateNormal];

Also you can copy attributes for the strings from PKDownloadButton.m file. There are functions:
static NSDictionary *DefaultTitleAttributes();
static NSDictionary *HighlitedTitleAttributes();

So I extracted some todos for me from your feedback:

  1. Update for swift
  2. Make it possible to add some new custom states.
  3. Add some localizedStringId property, or make DefaultTitleAttributes() and HighlitedTitleAttributes() functions public.

@ghost
Copy link

ghost commented Aug 21, 2017

Hello! how to add Downloadbutton to cell in table. I can't call delegate! Help me. Thank you

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants