0
votes

I'm doing a cool CA3DTransform while a UIScrollview is scrolling in the scrollViewDidScroll delegate method. It works perfectly when you use your finger to scroll, so when scrolling manually everything is perfect.

But, when I set scrollview contentoffset programmatically like:

[scrollView setContentOffSet:CGPointMake(0,460) animated:YES];

It still calls the delegate method scrollviewdidscroll, so the same animation methods are called, so I still see the correct animation, BUT, somehow parts of the view are missing during and after the animation! I've tried to set the layer.zPosition on all things and it doesn't seem to help. It should be fine since manually scrolling does work without parts of views going missing... Somehow calling this method programmatically differs and I have no idea why!

2
Post your CATransform3D code, more than likely something is strange with your perspective or clipping planes. Alternatively, disable your 3D perspective and confirm that views still show correctly. Then you can bring your 3D code in piece by piece until you determine the issue. - Sam
I did disable the 3D and then there are no issues, so it's definitely something with the 3D, but only when scrolling programmatically. - Bob de Graaf

2 Answers

0
votes

Post your question in this way is not very clear, considering that with the delegate scrollViewDidScroll, I can print me the code, either manually or programmatically.

...
UIScrollView *sv = [[UIScrollView alloc] initWithFrame:CGRectMake(0, 10, 320, 200)];
[sv setContentSize:CGSizeMake(640, 200)];
sv.delegate = self;
[sv setContentOffset:CGPointMake(320, 0) animated:YES];
[self.view addSubview:sv];
...

- (void)scrollViewDidScroll:(UIScrollView *)scrollView {
    NSLog(@"---%@---", NSStringFromCGPoint(scrollView.contentOffset));
}

In this simple example, you can see that the delegate actually works. Excuse the simplicity of the answer, but the only question you ask is hard to give you help.

0
votes

I had a similar problem (in the context of using a scrollview for a slideshow) but solved it by using scrollRectToVisible:NO (NO for no animations), and wrapped that inside a UIView animation block where I also put my animation code.