Is there a function to reload for sending data from main controller to header and bottom controller after calling API?
codobuxsocial opened this issue · 2 comments
codobuxsocial commented
Thanks alot first of all, this library has been really helpful and should have much more attention since it pretty awesome.
-
My question now is I am calling API in main controller where we have given TPDataSource, after fetching data from API i want to forward it to header and bottom controllers. Can you tell me how we can achieve that?
-
Also is there a way to blur the image when content is scrolled up top and show user name over it?
OfTheWolf commented
@codobuxsocial Thanks for nice words.
- You must already have a reference to headerVC and bottomVCs in main view controller. So you can pass data thorough that reference.
** %path to example%/ViewController.swift**
func headerViewController() -> UIViewController {
headerVC = UIStoryboard.init(name: "Main", bundle: nil).instantiateViewController(withIdentifier: "HeaderViewController") as? HeaderViewController
return headerVC!
}
func bottomViewController() -> UIViewController & PagerAwareProtocol {
pagerVC = UIStoryboard.init(name: "Main", bundle: nil).instantiateViewController(withIdentifier: "XLPagerTabStripExampleViewController") as! XLPagerTabStripExampleViewController
return pagerVC
}
headerVC.passData(...) // you can call anywhere in the code
pagerVC.passData(...) // you can call anywhere in the code
- See below TPProgressDelegate method. You can use progress to implement blur effect on scroll.
//MARK: TPProgressDelegate
func tp_scrollView(_ scrollView: UIScrollView, didUpdate progress: CGFloat) {
headerVC?.adjustBannerView(with: progress, headerHeight: headerHeight())
}
codobuxsocial commented
Thanks for the quick response, will play around with it!