evgenyneu / ios-imagescroll

iOS: example of using image view inside a scroll view with auto layout, written in Obective-C.
60 stars 15 forks source link

Incorrect Size Orientation #4

Closed davidfrasch closed 10 years ago

davidfrasch commented 10 years ago

Hey,

first of all thanks for this really helpfull project, but i have some Problems.

Sometimes when i open the Controller the Images is shown like this: bildschirmfoto 2014-05-19 um 11 15 09

instead of this:

bildschirmfoto 2014-05-19 um 11 15 43

Same Problem with Landscape, most of the Time everything is correct, and suddenly when i switch to Landscape i only can see a small part on the right side and the rest is hidden...

I copied your Code 1:1, the only two things which are different are: I´m using a xib File (but this can not really be the Problem). I get all my Pictures from a Webserver.

EDIT: So it seems that the Webserver was the Problem and a slow Internet Connection, so that the Images were not fully loaded and calculate incorrectly. Now every Image is shown correct when i open the Controller. Sadly i still have Problems with the Landscape Mode.

Portrait:

bildschirmfoto 2014-05-19 um 11 15 43

Landscape:

bildschirmfoto 2014-05-19 um 11 31 28

evgenyneu commented 10 years ago

Hi, thanks for feedback. Does not ring any bells for me, unfortunately.

1) Does my demo app work consistently for you?

2) If it does, I would try putting your images into this demo, possibly with with the network loading code, to see how it behaves. Just to isolate thing.

Let me know how it goes.

Thanks On May 19, 2014 7:20 PM, "Fosile" notifications@github.com wrote:

Hey,

first of all thanks for this really helpfull project, but i have some Problems.

Sometimes when i open the Controller the Images is shown like this: [image: bildschirmfoto 2014-05-19 um 11 15 09]https://cloud.githubusercontent.com/assets/5736296/3012181/3a895d84-df36-11e3-937e-dced3662ed2d.png

instead of this:

[image: bildschirmfoto 2014-05-19 um 11 15 43]https://cloud.githubusercontent.com/assets/5736296/3012182/461355f6-df36-11e3-98e7-f974fabda0c0.png

Same Problem with Landscape, most of the Time everything is correct, and suddenly when i switch to Landscape i only can see a small part on the left side and the rest is hidden...

I copied your Code 1:1, the only two things which are different are: I´m using a xib File (but this can not really be the Problem). I get all my Pictures from a Webserver.

— Reply to this email directly or view it on GitHubhttps://github.com/evgenyneu/ios-imagescroll/issues/4 .

davidfrasch commented 10 years ago

Yes your Demo App works correctly with your Example Images! BUT.... I took my Picture above and tried it in your Demo App and it shows the same (wrong)behavior in landscape, like in my App. This is the Picture: testimage

evgenyneu commented 10 years ago

Thanks for the image. I know what it is - my updateConstraints code is not run because ... image is square. Isn't that funny - I did not test with perfectly square images. Let me see if I can easily fix it.

evgenyneu commented 10 years ago

@Fosile thanks for reporting two real bugs in my code.

1) Now loading image in viewDidAppear instead of viewWillAppear. It did not report width/height correctly if loaded in landscape.

2) If image is square, the zoom scale did not change after orientation change, so scrollViewDidZoom did not fire and updateConstraints wasn't called. This little hack makes zoom scale always change:

if (minZoom == self.lastZoomScale) minZoom += 0.000001;
evgenyneu commented 10 years ago

Updated the demo. Let me know if you still have problems, @Fosile.

davidfrasch commented 10 years ago

Thank you very much for your quick fix. I tested it with a lot of different Images and it works perfectly!!!

evgenyneu commented 10 years ago

You are welcome. Thank you for your feedback. On May 19, 2014 9:49 PM, "Fosile" notifications@github.com wrote:

Thank you very much for your quick fix. I tested it with a lot of different Images and it works perfectly!!!

— Reply to this email directly or view it on GitHubhttps://github.com/evgenyneu/ios-imagescroll/issues/4#issuecomment-43492499 .