In the photoscroller app (iPhone app WWDC-104 Photos), uiscrollview images are shifted to the right when called using presentModalviewController

I saw a WWDC-104 video showing a UIScrollView for photos. I also downloaded the sample code. In my application, the structure is as follows:

(Root Class) Class A ---> Class B -----------> PhotoViewController (containing ScrollView)

I call the PhotoViewController class using the presentModalViewController method in class B.

But with each scrolling, the new image shifts to the right in appearance. A black vertical bar is visible to the left of the image, which expands with each hit. Thus, after 6-8 images, the image becomes completely black.

I have not written any other code yet. Just copied the classes.

Why does this happen when the PhotoViewController class is not the first class to load? Is there any property that needs to be set for ScrollView? Is there a mistake in this view? Hierarchy?

Also how to start from a specific image (Download from the 10th image)?

Any help / suggestion would be much appreciated.

EDIT:

alt text

After the first horizontal scroll

alt text

After the second horizontal scroll

alt text

+3
source share
2 answers

Didn't your PhotoViewController click on the UINavigationController when you use it in your application?

, NavigationController ScrollView, , PhotoViewController, .

- PhotoViewController UIView ScrollView UIView. NavigationController , .

UIView * intermediateView = [[UIView alloc] initWithFrame:pagingScrollViewFrame];
[intermediateView addSubview:pagingScrollView];
self.view = intermediateView;

: , , UIScrollView pagingEnabled

+4

, . ? , scrollview " ", .

0

Source: https://habr.com/ru/post/1767847/


All Articles