2

I am fairly new to using SnapKit and I've searched everywhere on the internet but could not find the right resource that answers my question. So here it goes. I have one UIView that is a subview of the view of the controller and I want its height to change dynamically with the height of its superview. So like this:

make.top.left.right.equalTo(view)
make.height.equalTo(view.safeAreaLayoutGuide.snp.height).multipliedBy(0.25)

However, when the view controller goes inside a navigation controller and shows a navigation bar, that constraint I set above does not calculate the height of the navigation bar that appears. So the navigation bar just covers my custom view. I am trying to figure out how to account for the height of the navigation bar when you try to set up constraint like above. Any ideas? I've tried make.height.equalTo(view.layoutMarginsGuide.snp.height).multipliedBy(0.25), but no luck.

Junsu Kim
  • 356
  • 3
  • 13

1 Answers1

6

am assuming you cant cope with navigation bar.

make.top.equalTo(view.safeAreaLayoutGuide)
make.leading.trailing.equalTo(view)
make.height.equalTo(view).multipliedBy(0.25)                       
Divine
  • 118
  • 1
  • 9