Sha256: a3e323272a77ff483b7dca6b2c44f231513e0a4bc83a6bc4ad742ce396a1a1d2

Contents?: true

Size: 1.46 KB

Versions: 1

Compression:

Stored size: 1.46 KB

Contents

##|
##|  UIView.frame
##|
Teacup.handler UIView, :left, :x { |x|
  f = self.frame
  f.origin.x = x
  self.frame = f
}

Teacup.handler UIView, :right { |r|
  f = self.frame
  f.origin.x = r - f.size.width
  self.frame = f
}

Teacup.handler UIView, :center_x, :middle_x { |x|
  c = self.center
  c.x = x
  self.center = c
}

Teacup.handler UIView, :top, :y { |y|
  f = self.frame
  f.origin.y = y
  self.frame = f
}

Teacup.handler UIView, :bottom { |b|
  f = self.frame
  f.origin.y = b - f.size.height
  self.frame = f
}

Teacup.handler UIView, :center_y, :middle_y { |y|
  c = self.center
  c.y = y
  self.center = c
}

Teacup.handler UIView, :width { |w|
  f = self.frame
  f.size.width = w
  self.frame = f
}

Teacup.handler UIView, :height { |h|
  f = self.frame
  f.size.height = h
  self.frame = f
}

Teacup.handler UIView, :origin { |origin|
  f = self.frame
  f.origin = origin
  self.frame = f
}

Teacup.handler UIView, :size { |size|
  if Symbol === size && size == :full
    if self.superview
      size = Size(self.superview.bounds.size)
    else
      size = self.frame.size
    end
  end
  f = self.frame
  f.size = size
  self.frame = f
}

Teacup.handler UIView, :frame { |frame|
  if Symbol === frame && frame == :full
    if self.superview
      frame = Rect(self.superview.bounds)
    else
      frame = self.frame
    end
  end
  self.frame = frame
}

##|
##|  UIButton
##|
Teacup.handler UIButton, :title { |title|
  self.setTitle(title, forState: UIControlStateNormal)
}

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
teacup-0.3.11 lib/teacup/z_core_extensions/z_handlers.rb