Hello, I am currently working on collection view header.
I want to make header of the collection view always stay up at the top. So I set the sectionHeadersPinToVisibleBounds property to true, but this did not work as expected.
When I scroll down the header moves along with the cells, but if I scroll up the header does not move and stays the same.
I guess I'm using it wrong. How can I fix this?
In ViewDidLoad i put code below.
let layout = col.collectionViewLayout as! UICollectionViewFlowLayout
layout.sectionHeadersPinToVisibleBounds = true
Thanks for reading this! Please help me
Selecting any option will automatically load the page
Post
Replies
Boosts
Views
Activity
Hello! I am currently working on a Collection View Controller which if scrolled up navigation bar appears and when collection view is scrolled down navigation bar disappears.
I was able to implement this features by using additionalSafeAreaInsets.
However if collection view is scrolled to the top so nav bar is hidden and if move on to the child view, the child view's nav bar also disappears.
Also changing additionalSafeAreaInsets in sub view does not change the inset.
I guess the additionalSafeAreaInsets feature is affecting the child view too. How can i prevent this?
Thanks for the apply in advance. Any comment will help me.
Hello, I am currently working on WkWebView.
In my view controller there is only on view which is WkWebView.
What I want to do is if I tap on that view I want nav bar and status bar to appear. I know how to show and hide those two components, but I am not sure how to detect the tap.
I've tried adding tap gesture recognizer to WkWebView, but it doesn't work.
I've also tried to embed a WkWebView to a view and add tap gesture recognizer to the view, but this also did not work.
Tapping only work for WkWebView, which only browsing is allowed.
Is there a way to show nav bar and status bar when tapped ? (separate from the WkWebView tapping its content.)
Hi, I'm currently working on changing navigation bar back button in run time. However it doesn't work.
Below is the code where i want to change my back button title.
What I want to do is if I scroll more than hightCheck i want to make my backButton title to be "back", else " ".
The method for changing back button title seems to work in the first time when the view loads up, but does not change after all.
Is it to change back Button title in run time?
override func scrollViewDidScroll(_ scrollView: UIScrollView) {
let a = tableView.tableHeaderView?.subviews[1]
let heightCheck = tableView.bounds.origin.y + a!.frame.height + navigationController!.navigationBar.frame.height
var backButtonTitle = " "
if heightCheck > a!.frame.origin.y{
backButtonTitle = "back"
}else{
backButtonTitle = " "
}
navigationController?.navigationBar.topItem?.backButtonTitle = backButtonTitle
}