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-4.0.0 lib/cocoa/sugarcube-awesome/awesome_exts.rb
sugarcube-3.5.0 lib/cocoa/sugarcube-awesome/awesome_exts.rb
sugarcube-3.4.2 lib/cocoa/sugarcube-awesome/awesome_exts.rb
sugarcube-3.4.1 lib/cocoa/sugarcube-awesome/awesome_exts.rb
sugarcube-3.4.0 lib/cocoa/sugarcube-awesome/awesome_exts.rb
sugarcube-3.3.7 lib/cocoa/sugarcube-awesome/awesome_exts.rb
sugarcube-3.3.6 lib/cocoa/sugarcube-awesome/awesome_exts.rb
sugarcube-3.3.5 lib/cocoa/sugarcube-awesome/awesome_exts.rb
sugarcube-3.3.4 lib/cocoa/sugarcube-awesome/awesome_exts.rb
sugarcube-3.3.3 lib/cocoa/sugarcube-awesome/awesome_exts.rb
sugarcube-3.3.2 lib/cocoa/sugarcube-awesome/awesome_exts.rb
sugarcube-3.3.1 lib/cocoa/sugarcube-awesome/awesome_exts.rb
sugarcube-3.3.0 lib/cocoa/sugarcube-awesome/awesome_exts.rb
sugarcube-3.2.0 lib/cocoa/sugarcube-awesome/awesome_exts.rb
sugarcube-3.1.1 lib/cocoa/sugarcube-awesome/awesome_exts.rb
sugarcube-3.1.0 lib/cocoa/sugarcube-awesome/awesome_exts.rb
sugarcube-3.0.8 lib/cocoa/sugarcube-awesome/awesome_exts.rb
sugarcube-3.0.7 lib/cocoa/sugarcube-awesome/awesome_exts.rb
sugarcube-3.0.6 lib/cocoa/sugarcube-awesome/awesome_exts.rb
sugarcube-3.0.5 lib/cocoa/sugarcube-awesome/awesome_exts.rb