Sha256: 4c7f6b2478ddd796899c41a400cf5b8ac462dcfb516e7b38ee665b8e19a32dea

Contents?: true

Size: 693 Bytes

Versions: 97

Compression:

Stored size: 693 Bytes

Contents

class Symbol

  def awesome_icon(options={})
    raise "the MotionAwesome gem is required to use sugarcube-awesome" unless defined? MotionAwesome
    text = MotionAwesome.hex_for_icon( MotionAwesome.xform_icon(self) )

    if options.key?(:size)
      font_size = options[:size]
      font_size = font_size.uifontsize if font_size.respond_to?(:uifontsize)
    else
      font_size = UIFont.systemFontSize
    end

    awesome_attrs = {NSFontAttributeName => MotionAwesome.font(font_size)}
    if options.key?(:color)
      awesome_attrs[NSForegroundColorAttributeName] = options[:color].uicolor
    end

    NSAttributedString.alloc.initWithString(text, attributes: awesome_attrs )
  end

end

Version data entries

97 entries across 97 versions & 1 rubygems

Version Path
sugarcube-1.3.7 lib/sugarcube-awesome/awesome_exts.rb
sugarcube-1.3.6 lib/sugarcube-awesome/awesome_exts.rb
sugarcube-1.3.5 lib/sugarcube-awesome/awesome_exts.rb
sugarcube-1.3.4 lib/sugarcube-awesome/awesome_exts.rb
sugarcube-1.3.3 lib/sugarcube-awesome/awesome_exts.rb
sugarcube-1.3.2 lib/sugarcube-awesome/awesome_exts.rb
sugarcube-1.3.1 lib/sugarcube-awesome/awesome_exts.rb
sugarcube-1.3.0 lib/sugarcube-awesome/awesome_exts.rb
sugarcube-1.1.0 lib/sugarcube-awesome/awesome_exts.rb
sugarcube-1.0.7 lib/sugarcube-awesome/awesome_exts.rb
sugarcube-1.0.6 lib/sugarcube-awesome/awesome_exts.rb
sugarcube-1.0.5 lib/sugarcube-awesome/awesome_exts.rb
sugarcube-1.0.4 lib/sugarcube-awesome/awesome_exts.rb
sugarcube-1.0.3 lib/sugarcube-awesome/awesome_exts.rb
sugarcube-1.0.2 lib/sugarcube-awesome/awesome_exts.rb
sugarcube-1.0.1 lib/sugarcube-awesome/awesome_exts.rb
sugarcube-1.0.0 lib/sugarcube-awesome/awesome_exts.rb