Skip to content

Instantly share code, notes, and snippets.

@scottymac
Forked from colinta/submit_button.rb
Created July 29, 2012 01:12
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save scottymac/3195574 to your computer and use it in GitHub Desktop.
Save scottymac/3195574 to your computer and use it in GitHub Desktop.
class SubmitButton < UIButton
def self.make(params={})
# return instance of SubmitButton (or any subclass)
@submitButton = self.buttonWithType(UIButtonTypeRoundedRect)
@submitButton.frame = params[:frame]
# defaults
@submitButton.titleLabel.font = UIFont.systemFontOfSize(14)
@submitButton.titleLabel.text = "Submit"
@submitButton.titleLabel.backgroundColor = UIColor.grayColor
@submitButton
end
end
# Usage:
# btn = SubmitButton.make(:frame => [[50, 325],[50, 50]])
# view.addSubview(btn)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment