Skip to content

Instantly share code, notes, and snippets.

@colinta
Created May 15, 2012 00:20
Show Gist options
  • Select an option

  • Save colinta/2698242 to your computer and use it in GitHub Desktop.

Select an option

Save colinta/2698242 to your computer and use it in GitHub Desktop.
glowing custom font
# from BubbleWrap
def rgba_color(r, g, b, a=1)
UIColor.colorWithRed((r/255.0), green:(g/255.0), blue:(b/255.0), alpha:a)
end
class MyApplicationController < UIViewController
def viewDidLoad
font = UIFont.fontWithName('Inconsolata', size:20)
color = rgba_color(255, 255, 255)
@label = UILabel.new
@label.font = font
@label.textColor = color
@label.text = 'Example text'
@label.frame = [[0, 0], [320, 30]] # play with this frame size, i'm making these numbers up
@label.setBackgroundColor(UIColor.clearColor);
shadow_color = rgba_color(200, 200, 255)
@label.layer.shadowColor = shadow_color.CGColor;
@label.layer.shadowOffset = [2, 2];
@label.layer.shadowRadius = 2.0;
@label.layer.shadowOpacity = 1.0;
@label.layer.masksToBounds = false;
view.addSubview(@label)
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment