Method: SugarCube::CoreGraphics.Offset
- Defined in:
- lib/ios/sugarcube-coregraphics/core_graphics.rb
.Offset(horizontal_or_offset, vertical = nil) ⇒ Object
Accepts 1 or 2 arguments. 1 argument should be an Array, UIOffset, CGPoint, CGSize, or Numeric 2 should be horizontal, vertical
184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 |
# File 'lib/ios/sugarcube-coregraphics/core_graphics.rb', line 184 def Offset(horizontal_or_offset, vertical=nil) unless vertical case horizontal_or_offset when UIOffset horizontal = horizontal_or_offset.horizontal vertical = horizontal_or_offset.vertical when CGPoint horizontal = horizontal_or_offset.x vertical = horizontal_or_offset.y when CGSize horizontal = horizontal_or_offset.width vertical = horizontal_or_offset.height when Array horizontal = horizontal_or_offset[0] vertical = horizontal_or_offset[1] when Numeric horizontal = horizontal_or_offset vertical = horizontal_or_offset else raise RuntimeError.new("Invalid argument sent to Offset(#{horizontal_or_offset.inspect})") end else horizontal = horizontal_or_offset end return UIOffset.new(horizontal, vertical) end |