简体   繁体   中英

iOS large title not working with background view behind the scrollView

I'm using large titles, in the main view I have a scrollView and a view behind the scrollView that is a background image. When I do this, large titles doesn't work (are always big while you scroll) because the scrollView is not the first element inside the main view. If I change the order, the background image covers the scroll view.

Any solutions? Thanks!!

You can add the scrollview first then your background, and swap the zPosition of the 2 views.

view.addSubviews([scrollView, background])
scrollView.layer.zPosition = 1
background.layer.zPostion = 0

我找到了解决方案,将背景视图移到了滚动视图中,并附加了约束,使其附加到主视图中。

Try to put your Image View inside ScrollView content view. Using constraints pin ImageView to top, bottom, trailing and leading edges of SafeArea(second image).

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM