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

Implement storyboard (or xib) use #35

Closed
klauslanza opened this issue Nov 20, 2014 · 11 comments
Closed

Implement storyboard (or xib) use #35

klauslanza opened this issue Nov 20, 2014 · 11 comments
Assignees
Labels

Comments

@klauslanza
Copy link

It would be useful to be able to set the buttons directly in storyboards, just by changing the class of the normal unbutton object. Any plan on implementing it?

@cauli
Copy link

cauli commented Dec 10, 2014

+1

@tandavas
Copy link
Member

@klauslanza @cauli Thank you for dropping by and sorry for the late response. HTPressableButton also works with storyboard. We will update the project very soon with storyboard example along with detailed screenshot tutorials on README about how to add HTPressableButton to your storyboard.

@tandavas tandavas assigned tandavas and herinkc and unassigned tandavas and herinkc Dec 10, 2014
@klauslanza
Copy link
Author

That's great, I'll try it as soon as I can on my projects!

@cauli
Copy link

cauli commented Dec 10, 2014

I've tried it today and it works like a charm. Thanks!

@klauslanza
Copy link
Author

Just by changing UIButton class to HTPressableButton? It's not working for me.

@tandavas
Copy link
Member

Hey @klauslanza, I just made a simple quick detailed tutorial for you:

  1. Declare HTPressableButton in your view controller
    step1

  2. Set up the button style that you want
    step2

  3. Go to your story board and drag a button to your storyboard.
    step3

  4. Resize the button
    step4

  5. Set the button type to custom
    step5

  6. Set the button class to HTPressableButton
    step6

  7. Connect your HTPressableButton to the code
    step7

After you connect the button with the code, you should see this:
step8

  1. Hit run!

Now you can enjoy pressing on HTPressableButton! 😄 🍻 😃

@tandavas
Copy link
Member

@klauslanza Please let me know if that works for you 😄

@cauli
Copy link

cauli commented Dec 11, 2014

Thanks for the tutorial, @tandavas. What I did was a little bit different. I Used User-Defined Runtime Attributes in the storyboard for more flexibility, setting 'buttonColor', 'shadowColor', and other properties I found in HTPressableButton.h until it felt right.

I also slightly modified the plugin to better fit my needs, because I think it is not impossible to set some things (like the button style) directly via Runtime Attributes.

I also modified the plugin to use Storyboard-defined UIEdgeInsets, that allowed me to put images inside the button.

I also modified it to set the backgroundColor of the button to clearColor, that allowed me to create colored buttons on the storyboard just for organization (it could also be possible to set this color directly to the HTPressableButton)

I will upload these changes to my fork of the project later today.

@klauslanza
Copy link
Author

That's great! Best issue followup ever :-)

I was trying just by changing the class because I've seen components doing this and using "User Defined Runtime Attributes" dialog for setting the properties of the button. This solution have the advantage (or disadvantage :-) of being IB only, no code required. Do you think it is implementable? I will give a thought on the weekend in case.

EDIT:
Just seen @cauli comment, same idea :-)

@tandavas
Copy link
Member

@cauli That sounds awesome! Feel free to send a pull request, and I will have @herinkc review it (she is quite busy these days though). 😄

@tandavas
Copy link
Member

@klauslanza

That's great! Best issue followup ever :-)

Thank you!

Do you think it is implementable?

Yes, we definitely can implement that! @herinkc and I thought about this earlier but we couldn't find time to implement it 😢

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

No branches or pull requests

4 participants