• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
How to properly flip a UIView's coordinate system
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

How to properly flip a UIView's coordinate system


  • Subject: How to properly flip a UIView's coordinate system
  • From: Markus Spoettl <email@hidden>
  • Date: Sat, 21 Sep 2013 22:38:47 +0200

Hi,

I have a UIView on iOS that shares (a lot of) code with an NSView I have on OSX. That code relies on a LLO (lower left origin) coordinate system and it's not an option to change that.

So I transform the coordinate system of the view by setting

[self setTransform:CGAffineTransformMakeScale(1, -1)];

in the UIView variant's -initializer. That works well, it effects all areas of view code the right way, including drawing and touch-events. Just what I want. Or so it seems.

Something must be wrong, because in some situations, when I animate the view's frame (using UIView's -animateWithDuration::: methods), the system seems to have trouble handling this view properly.

For example: Imagine the view taking up the top half of the screen, so the frame is {0, 0, 768, 502}. When I animate the frame to cover the entire screen {0, 0, 768, 1004} the view grows instantly (half the view is now invisible beyond the top edge) and only the position of the view gets animated. The final position and frame are correct, the way it gets there isn't.

When I remove the transformation, the animation takes place correctly, growing its frame, not just changing the position. Also, when I animate the frame, leaving the size as is, the animation does what is expected, too.

So, it's the transform. Can I do something about that?

Regards
Markus
--
__________________________________________
Markus Spoettl
_______________________________________________

Cocoa-dev mailing list (email@hidden)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden


  • Follow-Ups:
    • Re: How to properly flip a UIView's coordinate system
      • From: Marcel Weiher <email@hidden>
    • Re: How to properly flip a UIView's coordinate system
      • From: Dave <email@hidden>
    • Re: How to properly flip a UIView's coordinate system
      • From: Kyle Sluder <email@hidden>
    • Re: How to properly flip a UIView's coordinate system
      • From: Quincey Morris <email@hidden>
  • Prev by Date: Re: Strange behaviour of iPhone
  • Next by Date: Re: How to properly flip a UIView's coordinate system
  • Previous by thread: Re: Scroll a collection
  • Next by thread: Re: How to properly flip a UIView's coordinate system
  • Index(es):
    • Date
    • Thread