UIScrollview Autolayout Issue

前端 未结 9 678
广开言路
广开言路 2020-12-05 07:19

I have a problem with autolayout(maybe) and my scrollview!

My Problem

  1. I scroll down \"View\"
9条回答
  •  Happy的楠姐
    2020-12-05 07:38

    if you are still searching for an answer i found it today after two days of headbanging the wall. I will just paste you the code, but the most important thing is when you load your scrollView..

        -(void)viewWillAppear:(BOOL)animated{
    
        [scrollView setFrame:CGRectMake(0, 0, 320, 800)];
    }
    
    -(void)viewDidAppear:(BOOL)animated
    {
        [scrollView setScrollEnabled:YES];
        [scrollView setContentSize:CGSizeMake(320, 800)];
    
    }
    

    all this is loaded before -(void)viewDidLoad

    notice the height is in both instances 800, which is crucial for resolving this problem. good luck with your project ;)

提交回复
热议问题