0

I have an app where I have a rectangle that the user can rotate and pan using their fingers. I'd simply like to know what the frame is of this rotated view so I can find out if it intersects another rectangular UIView (can't use the frame property because it gets invalidated when the UIView gets transformed). What's the easiest way to accomplish this?

Ser Pounce
  • 14,196
  • 18
  • 84
  • 169

1 Answers1

0

Every UIView has a property frame which is of type CGRect.

You can access it using view.frame.

After the transform is applied you can use the bounds and center property on the view to get the orientation. It may take a little bit of calculation but i hope you can get to it easily.

Refer to this image from an answer to this question.

Community
  • 1
  • 1
Praveen S
  • 10,355
  • 2
  • 43
  • 69
  • The frame property gets invalidated when there is a transformation. – Ser Pounce Mar 26 '13 at 06:13
  • Yes i am sorry i forgot about the transform. – Praveen S Mar 26 '13 at 06:17
  • Side note (just in case): Please don't migrate spam (re: *Can a unlocked iphone use an pre-paid sim card with rogers?*). Also, don't vote to migrate when you don't know the target site's faq. Phone and phone service questions are off topic for [su]. Thanks. –  Mar 27 '13 at 12:07