class NSString

Public Instance Methods

is_digits_only?() click to toggle source
# File lib/purplish-red/non-ui/ns_string.rb, line 36
def is_digits_only?
  self.split('').detect {|e| e < '0' || e > '9'}.nil?
end
to_btn() click to toggle source
# File lib/purplish-red/non-ui/ns_string.rb, line 26
def to_btn
  self.to_btn_template_rendering_mode(false)
end
to_btn_template_rendering_mode(template_or_not) click to toggle source
# File lib/purplish-red/non-ui/ns_string.rb, line 12
def to_btn_template_rendering_mode(template_or_not)
  if template_or_not
    img = self.to_imgt
  else
    img = self.to_img
  end
  b = UIButton.buttonWithType(UIButtonTypeCustom)
  b.frame = [[0,0], [img.size.width, img.size.height]]
  b.setImage(img, forState:UIControlStateNormal)

  b
end
to_btnt() click to toggle source
# File lib/purplish-red/non-ui/ns_string.rb, line 31
def to_btnt
  self.to_btn_template_rendering_mode(true)
end
to_img() click to toggle source
# File lib/purplish-red/non-ui/ns_string.rb, line 2
def to_img
  UIImage.imageNamed(self)
end
to_imgt() click to toggle source
# File lib/purplish-red/non-ui/ns_string.rb, line 7
def to_imgt
  UIImage.imageNamed(self).imageWithRenderingMode(UIImageRenderingModeAlwaysTemplate)
end