lib/sugarcube-uikit/uiview.rb in sugarcube-1.5.0 vs lib/sugarcube-uikit/uiview.rb in sugarcube-1.5.1

- old
+ new

@@ -107,17 +107,25 @@ end return convert_frame_to(destination) end def convert_frame_to(destination) - return self.convertRect(CGRectMake(0, 0, self.frame.size.width, self.frame.size.height), toView:destination) + return self.convert_rect(CGRectMake(0, 0, self.frame.size.width, self.frame.size.height), to: destination) end def convert_frame_from(source) - return self.convertRect(CGRectMake(0, 0, source.frame.size.width, source.frame.size.height), fromView:source) + return self.convert_rect(CGRectMake(0, 0, source.frame.size.width, source.frame.size.height), from: source) end + def convert_rect(rect, to: destination) + return self.convertRect(rect, toView: destination) + end + + def convert_rect(rect, from: source) + return self.convertRect(rect, fromView: source) + end + # Returns the receiver's bounds in the coordinate system of `destination` def convert_origin(destination) message = "The (ambiguously named) `convert_origin` method has been deprecated, use `convert_origin_to` (or `convert_origin_from`)" if defined?(SugarCube::Legacy) SugarCube::Legacy.log(message) @@ -125,15 +133,23 @@ NSLog(message) end return self.convert_origin_to(destination) end + def convert_point(point, to: destination) + return self.convertPoint(point, toView: destination) + end + + def convert_point(point, from: source) + return self.convertPoint(point, fromView: source) + end + def convert_origin_to(destination) - return self.convertPoint([0, 0], toView:destination) + return self.convert_point([0, 0], to: destination) end def convert_origin_from(source) - return self.convertPoint([0, 0], fromView:source) + return self.convert_point([0, 0], from: source) end # Easily get and set a UIView's frame properties def x