IOS: scroll view only works after keyboard appears

I did a scroll with a lot of text fields. I added an updated TPKeyBoardAvoidingScrollView and added it to the scroll file owner. I added the output to the .h file synthesized in the .m file and adding the line [self.view addSubview:scrollObject];

The problem is that the view starts scrolling only after the keyboard appears. It does not scroll as soon as the image loads.

Any solution for this?

Adding these lines did not solve my request

 scrollViewObj = [[UIScrollView alloc] init]; self.automaticallyAdjustsScrollViewInsets = NO; [scrollViewObj setScrollEnabled:YES]; scrollViewObj.maximumZoomScale = 4.0; scrollViewObj.minimumZoomScale = 0.75; scrollViewObj.clipsToBounds = YES; 
+6
source share
2 answers

You have:

 scrollViewObj.contentsize > scrollViewObj.frame.size.height ? 

also how do you add this ton of text fields? (Software / storyboard)?

0
source

I fixed this problem by adding the following to the end of viewDidLoad:

scrollViewObj.contentInset = UIEdgeInsetsMake (0, 0, self.view.bounds.size.height * 2, 0);

The order of parameters: top, left, bottom, right. The experiment shows that the bottom edge insert should be set to a value greater than the height of the content. Other mounting inserts work best when set to 0.

0
source

Source: https://habr.com/ru/post/957127/


All Articles