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-3.0.4 lib/cocoa/sugarcube-awesome/awesome_exts.rb
sugarcube-3.0.3 lib/cocoa/sugarcube-awesome/awesome_exts.rb
sugarcube-3.0.2 lib/cocoa/sugarcube-awesome/awesome_exts.rb
sugarcube-3.0.1 lib/cocoa/sugarcube-awesome/awesome_exts.rb
sugarcube-3.0.0 lib/cocoa/sugarcube-awesome/awesome_exts.rb
sugarcube-2.12.3 lib/cocoa/sugarcube-awesome/awesome_exts.rb
sugarcube-2.12.2 lib/cocoa/sugarcube-awesome/awesome_exts.rb
sugarcube-2.12.1 lib/cocoa/sugarcube-awesome/awesome_exts.rb
sugarcube-2.12.0 lib/cocoa/sugarcube-awesome/awesome_exts.rb
sugarcube-2.11.1 lib/cocoa/sugarcube-awesome/awesome_exts.rb
sugarcube-2.11.0 lib/cocoa/sugarcube-awesome/awesome_exts.rb
sugarcube-2.10.0 lib/cocoa/sugarcube-awesome/awesome_exts.rb
sugarcube-2.9.1 lib/cocoa/sugarcube-awesome/awesome_exts.rb
sugarcube-2.8.2 lib/cocoa/sugarcube-awesome/awesome_exts.rb
sugarcube-2.8.1 lib/cocoa/sugarcube-awesome/awesome_exts.rb
sugarcube-2.8.0 lib/cocoa/sugarcube-awesome/awesome_exts.rb
sugarcube-2.7.1 lib/cocoa/sugarcube-awesome/awesome_exts.rb
sugarcube-2.7.0 lib/cocoa/sugarcube-awesome/awesome_exts.rb
sugarcube-2.6.0 lib/cocoa/sugarcube-awesome/awesome_exts.rb
sugarcube-2.5.0 lib/cocoa/sugarcube-awesome/awesome_exts.rb