简体   繁体   中英

Autolayout in iOS

So I am new to autolayout in iOS and so I have run into a problem.

My program has 2 imageviews which can be dragged around,pinched, zoomed in and rotated. The user should be able to drag the image views anywhere on the screen. So basically I dont want constraints holding my images in place. I need autolayout to be off for the 2 image views alone (and I know thats not possible).

So whats happening now is when I run the program, the image views can be dragged to anywhere in the screen but when I rotate it or pinch to zoom it, the image moves from its current position and gets placed at the center of the screen, and there it will be zoomed or rotated.( Center contraints are there and they are on lowest priority). I can't seem to delete the constraints either.

Is there anyway I can avoid the constraints just for the image views???If not, what can be the solution to my problem??

override -(void) layoutSubviews in your UIViewController

That should do the trick :)

Take a look at this question. It explains how to disable auto layout for a specific uiview at runtime.

Can I disable autolayout for a specific subview at runtime?

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM