Skip to content

Instantly share code, notes, and snippets.

@colinta
Created May 13, 2012 19:45
Show Gist options
  • Save colinta/2689911 to your computer and use it in GitHub Desktop.
Save colinta/2689911 to your computer and use it in GitHub Desktop.
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('DS-Digital', size:20)
color = rgba_color(255, 255, 255)
@label = UILabel.new
@label.font = font
@label.textColor = color
@label.text = 'DS-Digital font'
@label.frame = [[0, 0], [self.width, self.height]]
@label.lineBreakMode = UILineBreakModeWordWrap
@label.numberOfLines = 0
@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;
@label.sizeToFit
view.addSubview(@label)
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment