1

Can I pause a view for a certain amount of time? Basically, while an action is occurring, my view becomes messed up and I cannot figure out why. Everything gets shifted, and I've been looking through the code line by line for hours. So can I prevent the view from changing itself and then somehow resume it after the action is over? I really don't know if this is a stupid question, but thanks for your help!

Jack Humphries
  • 13,056
  • 14
  • 84
  • 125
  • 1
    Jack, you should instead find out why that is happening and fix it. That's the best advise I can give you. If you need help, I am here. :) – Rui Peres Aug 01 '11 at 13:36
  • What is the action? What do you mean by "shifted"? – Luke Aug 01 '11 at 14:11
  • The action is sending something to a server, for whatever reason the entire view is shifted. After the view is shifted, I have the coordinates outputted to the log, and it thinks the view is at 0,0, even though it's not. – Jack Humphries Aug 01 '11 at 14:20
  • Check its superview frame, also check for any transformations. – Joe Aug 01 '11 at 14:23
  • Paste the code and let's solve the real problem instead – Man of One Way Aug 01 '11 at 14:26
  • Believe me, I'd love to do that, but I'm not authorized to release the code. Ahhhhhhhh, I'll figure it out eventually and post my answer. – Jack Humphries Aug 01 '11 at 14:31

2 Answers2

1

The action is sending something to a server, for whatever reason the entire view is shifted. After the view is shifted, I have the coordinates outputted to the log, and it thinks the view is at 0,0, even though it's not.

I think you might be getting mixed up in the distinction between frames & bounds?

From this link

The frame of an UIView is the rectangle, expressed as a location (x,y) and size (width,height) relative to the superview it is contained within.

The bounds of an UIView is the rectangle, expressed as a location (x,y) and size (width,height) relative to its own coordinate system (0,0).

Essentially, if you're looking at the origin coordinates of the bounds of your view, it will always be 0,0. Instead, you should look at its frame coordinates. I hope this helps you in figuring out the problem.

Community
  • 1
  • 1
Manish Burman
  • 3,069
  • 2
  • 30
  • 35
0

No, there's no general mechanism for preventing changes to a view. If the view in question is your own UIView subclass, you can of course override the methods that modify the view and effectively prevent changes that way. That'd be a lot of work, however, and I don't think the result would be worth the effort; you'll be much better off finding the real problem and fixing it. It's always easier and better to work with the framework and not against it.

Caleb
  • 124,013
  • 19
  • 183
  • 272