Reputation: 5009
It is a bit tricky to explain, but I will try. When I navigate backwards from the "Mercurial page" (see picture) when the scrollview is scrolled, my app crashes. But when it is not scrolled, the app does not crash... I have implemented <UIScrollViewDelegate>
Any help would be greatly appreciated! Here are some pictures and some code that I have in my app:
-(void)viewDidLayoutSubviews{
[super viewDidLayoutSubviews];
[self.scrollView layoutIfNeeded];
self.scrollView.contentSize=self.contentView.bounds.size;
}
- (void) scrollViewDidScroll:(UIScrollView *)scrollView
{
CGFloat yPos = -scrollView.contentOffset.y;
if (yPos > 0) {
CGRect imgRect = self.imageView.frame;
imgRect.origin.y = scrollView.contentOffset.y;
imgRect.size.height = HeaderHeight+yPos;
self.imageView.frame = imgRect;
}
Upvotes: 3
Views: 872
Reputation: 1246
this worked for me.
-(void)viewWillDisappear:(BOOL)animated{
[self.scrollView setDelegate:nil];
}
Upvotes: 6