motion-prime/views/view_styler.rb in motion-prime-0.3.3 vs motion-prime/views/view_styler.rb in motion-prime-0.4.0

- old
+ new

@@ -40,15 +40,15 @@ end def setValue(value, forUndefinedKey: key) # return if value.nil? # ignore options - return if options[:section].is_a?(DrawSection) && %w[gradient].include?(key.to_s) + return if key == 'section' && !view.respond_to?(:section=) return if key == 'size_to_fit' && view.is_a?(UILabel) return if (key == 'url' || key == 'default') && view.is_a?(UIImageView) return if %w[ - styles + styles has_drawn_content width height top right bottom left value_type max_width max_outer_width min_width min_outer_width max_height max_outer_height min_height min_outer_width height_to_fit container parent_frame].include? key.to_s @@ -120,9 +120,13 @@ attributedString = NSAttributedString.alloc.initWithString(value[:text], attributes: attributes) if underline_range = value[:underline] attributedString = NSMutableAttributedString.alloc.initWithAttributedString(attributedString) attributedString.addAttributes({NSUnderlineStyleAttributeName => NSUnderlineStyleSingle}, range: underline_range) + end + if fragment_color = value[:fragment_color] + attributedString = NSMutableAttributedString.alloc.initWithAttributedString(attributedString) + attributedString.addAttributes({NSForegroundColorAttributeName => fragment_color[:color].uicolor}, range: fragment_color[:range]) end if view.is_a?(UIButton) view.setAttributedTitle attributedString, forState: UIControlStateNormal else view.attributedText = attributedString \ No newline at end of file