In addition to setting the center of a view's frame, now you can query it.

This commit is contained in:
Ross Boucher
2009-02-04 08:52:18 -07:00
parent f671b89da5
commit ecaab49c08
+9
View File
@@ -573,6 +573,15 @@ var DOMElementPrototype = nil,
[self setFrameOrigin:CGPointMake(aPoint.x - _frame.size.width / 2.0, aPoint.y - _frame.size.height / 2.0)];
}
/*!
Returns the center of the receiver's frame to the provided point. The point is defined in the superview's coordinate system.
@return CGPoint the center point of the receiver's frame
*/
- (void)center
{
return CGPointMake(_frame.size.width / 2.0 + _frame.origin.x, _frame.size.height / 2.0 + _frame.origin.y);
}
/*!
Sets the receiver's frame origin to the provided point. The point is defined in the superview's coordinate system.
The method posts a CPViewFrameDidChangeNotification to the default notification center if the receiver