It seems that the photo view controller tries to scale it to full size, but cuts off the edges and doesn't let you zoom out. I've tried changing the scaling mode on the photo view, but that didn't seem to make a difference. Anyone have an idea what might be causing it?
Thanks,
Brandon
On Jan 5, 7:43 pm, Brandon Keepers <bran...@collectiveidea.com> wrote:
> There seems to be an issue withTTPhotoViewControllerwhere it cropsimagesthat are irregularly shaped. You can see it in the TTCatalog app and in this app that we just published (http://itunes.apple.com/us/app/stryker-ivs/id345585768?mt=8)
I believe the problem is in the implementation of -frameOfPageAtIndex: in TTScrollView. (I ran into this months ago, but I needed to subclass TTScrollView anyway, sorry about not reporting this earlier.)
> - (CGRect)frameOfPageAtIndex:(NSInteger)pageIndex {
...
> CGFloat width, height;
> if (UIInterfaceOrientationIsLandscape(_orientation)) {
> if (size.width > size.height) {
> height = self.height;
> width = size.height/size.width * self.height;
> } else {
> height = size.width/size.height * self.width;
> width = self.width;
> }
> } else {
> if (size.width > size.height) {
> width = self.width;
> height = size.height/size.width * self.width;
> } else {
> width = size.width/size.height * self.height;
> height = self.height;
> }
> }
...
>
> }
The check whether to make the image fit to the width or to the height is too simplistic. A portrait oriented image can still be too wide to fit on the iPhone screen (e.g., the last image in the TTCatalog photo browser.) It should check the ratio between width and height, which is simply a matter of replacing
> if (size.width > size.height) {
with
> if (size.width / size.height > self.width / self.height) {
Additionally, there is another bug in the TTPhotoViewController: because it rotates _and_ lets the scrollView rotate too the image will do a wild animation, rotating twice and ending with the image upside down. To make the fix above also work for the TTPhotoViewController the rotation of the _scrollView must be disabled.
I just committed a patch containing both fixes to our fork: http://github.com/tupil/three20/commit/416d6f1f57b1f7fa1ee99d8100beb6399b69cf8d
Cherry-pick away ;)
--
Regards,
Eelco Lempsink
> I just committed a patch containing both fixes to our fork:http://github.com/tupil/three20/commit/416d6f1f57b1f7fa1ee99d8100beb6...
On Jan 21, 3:23 pm, Eelco Lempsink <ee...@lempsink.nl> wrote:
> I just committed a patch containing both fixes to our fork:http://github.com/tupil/three20/commit/416d6f1f57b1f7fa1ee99d8100beb6...
Awesome! It works great. Can someone from facebook pull in this
patch?