0

I am building an app where i need to have flexible header above collection view. I have implemented Material Component Flexible header and added a header view from xib Here is my code

let heroHeaderView = HeroHeaderView()
self.addChildViewController(appBar.headerViewController)
appBar.headerViewController.layoutDelegate = self
let headerView = appBar.headerViewController.headerView
headerView.backgroundColor = .clear
headerView.maximumHeight = HeroHeaderView.Constants.maxHeight
headerView.minimumHeight = HeroHeaderView.Constants.minHeight

heroHeaderView.frame = headerView.bounds
headerView.insertSubview(heroHeaderView, at: 0)
headerView.canOverExtend = false
headerView.trackingScrollView = self.collectionView

In xib i have added two buttons. ibaction for both not getting called. if i do headerView.bringSubview(toFront: heroHeaderView) those buttons ibaction get called but it hides my appbar. How can i have both appbar and buttons touches

Ashwin Sathawane
  • 383
  • 2
  • 14
  • have you created appBar on xib? have you provide any constraint between heroHeaderview and appbar? – Muneeba Nov 24 '17 at 10:51
  • No. i have not created app bar on xib. its default appBar created with `appBar.navigationBar.backgroundColor = .clear appBar.headerViewController.layoutDelegate = self appBar.navigationBar.tintColor = .white appBar.navigationBar.title = "Title" ` – Ashwin Sathawane Nov 24 '17 at 11:02

0 Answers0