Hi all,
this is my first ever question so apologies if it's not descriptive enough.
I currently have an object that can be moved along an x axis with dragging. I need to limit it's movement to half of the screen.
Can anyone help
Hi all,
this is my first ever question so apologies if it's not descriptive enough.
I currently have an object that can be moved along an x axis with dragging. I need to limit it's movement to half of the screen.
Can anyone help
Well that is simple. Assuming we are talking about moving a UIView
:
// Only move the object if its right bounding box position is
// in the first half of the screen
if ((someObjectView.frame.origin.x + someObjectView.frame.size.width) <
(containingView.bounds.size.width / 2.0) {
// Move the object
}
You fill in the blanks :-)