0

Code that worked well before ios 13 has problems with ios 13. The code below is the code that gets the same image as the screen capture of the entire scroll view.

    UIGraphicsBeginImageContext(scrollview.contentSize);

    CGPoint savedContentOffset = scrollview.contentOffset;
    CGRect savedFrame = scrollview.frame;

    scrollview.contentOffset = CGPointZero;
    scrollview.frame = CGRectMake(0, 0, scrollview.contentSize.width, scrollview.contentSize.height);

    [scrollview.layer renderInContext: UIGraphicsGetCurrentContext()];
    image = UIGraphicsGetImageFromCurrentImageContext();

    scrollview.contentOffset = savedContentOffset;
    scrollview.frame = savedFrame;

    UIGraphicsEndImageContext();

But when I run that code in ios 13, the bottom part looks truncated. From the beginning of the scroll, the iPhone shows the normal image up to the bottom of the screen, but the bottom is not visible.

1 Answers1

2

I found the answer to my problem. The problem was that the frame did not change.

scrollview.frame = CGRectMake(0, 0, scrollview.contentSize.width,     scrollview.contentSize.height);

Instead of this using

scrollview.layer.frame = CGRectMake(0, 0, scrollview.contentSize.width, scrollview.contentSize.height);