1

I'm retrieving json data from server. The json data includes some images and more text and last but not least json size is not predictable.

Here is how I retrieve json:

-(void)viewWillAppear:(BOOL)animated {
    if (self.jsonUrl == nil) { 
    // This control is about MWPhotoBrowser. If user returned from photo browser do not retrieve data twice

        self.view.layer.shadowOpacity = 0.75f;
        self.view.layer.shadowRadius = 10.0f;
        self.view.layer.shadowColor = [UIColor blackColor].CGColor;

        if (![self.slidingViewController.underRightViewController isKindOfClass:[DetailContextViewController class]]) {
            self.slidingViewController.underRightViewController  = [self.storyboard instantiateViewControllerWithIdentifier:@"DetailAbout"];
        }

        self.jsonUrl = [self.exampleAd getAdJSONLink];
        NSLog(@"%@", self.jsonUrl); // 

        [self backgroundTask]; // retrieving data
    } else {
        // User returned from MWPhotoBrowser so set the current height again/
        // This is not working somehow.
        [self.scrollView setContentSize:(CGSizeMake(320, currentHeight + 10))];
    }
}

I'm adding all those data to an UIScrollView as a subview. Let's say this is B view. So height of scrollview is uncertain. I'm calculating the height and setting like this:

[self.scrollView setContentSize:(CGSizeMake(320, currentHeight + 10))];

That's working well. Here is my problems: If I go back to A from B and again go A to B, content size is not working. Scrolling not working too, but my currentHeight is showing the right value. Even the retrieving method is not working enough, actually there is something like cache.

There is same problem while using MWPhotoBrowser. When I use present modal controller than return to B view again scroll is not working.

What am I doing wrong, any approach or clue would be great.

0 Answers0