I have a table view with cells containing text views as well as images. My project is currently using AutoLayout. My goal is to display the image in full screen while listening to it. One option is to use the modal view manager, but I want this work to be similar to how touching images in the facebook application works, the application centers the image and fades the background.
Since I use autolayout, I cannot just set the image frame to fill the screen. Instead, I need to use autodetection restrictions. In my view of the image there are 5 restrictions, a restriction that sets the distance from the bottom of the cell, as well as the left right sides and one that controls the height of the image. The latter is a vertical limitation of the space between textual supervision of the image and the upper part of the image. Although this would seem to be contrary to the height and lower level restrictions, for some reason, the constructor interface makes me have this. To avoid problems, I set this restriction priority to less than 1000 (the image should never overlap the text image in any case, since the height of the table cell is set so that everything will fit perfectly).
To center the image, I set the distance on the left and right to zero and remove the restriction on vertical space. To center the image, I replace the lower space constraint with the center y alignment constraint on UIWindow , and not on tableviewcell. I want it to be in the center of the screen, not in the camera.
To get the main window, I use this:
AppDelegate* myDelegate = (((AppDelegate*) [UIApplication sharedApplication].delegate)); //access main window using myDelegate.window
Then, to set the limit:
However, this does not work. Changing the width and height of the image is very simple. However, when reading the restriction on the image limit, I get an unsatisfactory layout - apparently, the restriction conflicts with another restriction, which sets the distance between the bottom and the image representation to 14, this is the very restriction that I just deleted. Thus, it seems that this does not actually eliminate the restriction.
When I continue and let the application violate the restriction, the image is viewed, but in the wrong place. It does not center on the screen. It moves up and down the screen.
Obviously what I'm doing wrong. What am I doing wrong?