A
A
artem-Kolyadin2018-07-02 00:57:46
iOS
artem-Kolyadin, 2018-07-02 00:57:46

How to remove lags in a ScrollView that scrolls under a transparent navBar?

I get to this controller from the navigationController, which has a tab bar. When switching, I hide the tabBar, and make the navigation bar transparent so that the photo is right under the "back" to the main button. To do this, in viewWillAppear I do the following:

override func viewWillAppear(_ animated: Bool) {
        navigationController?.navigationBar.tintColor = .white
        self.navigationController?.navigationBar.setBackgroundImage(UIImage(), for: UIBarMetrics.default)
        self.navigationController?.navigationBar.shadowImage = UIImage()
        self.navigationController?.navigationBar.isTranslucent = true
        self.tabBarController?.tabBar.isHidden = true
    }

Problems:
1: When loading, initially everything is displayed like this:
5b394c0e02249560015857.png
And only then, after a delay noticeable to the human eye, it becomes like this (in fact, as I want):
5b394a31eb1f1044698232.png
2: If you swipe down, then the picture and the whole view float away from under the navigation bar, and with some strange twitches and lags (and also returns under this navigation bar). I would like to know how to remove these lags and block scrolling down to such an extent that the picture does not float away from under the navbar and does not leave an empty white space. There are suspicions that I did not quite correctly set the constraints in order to implement the work of this scrollView at all, it also strains what I had to do -44 for the scroll view so that it crawls under the navigation bar, it looks like a crutch.
Here is the hierarchy and the whole autoLayout:
5b394e2be1cf3435492315.png

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
doublench21, 2018-07-02
@artem-Kolyadin

Well, you probably don't need to hook it to SafeArea , but hook it directly to SuperView . Then you don't need to write -44, it will just be 0.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question