Paging a CollectionView horizontally by section - ios

How do you set up a collectionView to page horizontally by SECTION much like the native emoji keyboard on iPhone?
So I want the sections to scroll vertically which is working fine, but then if the user swipes the screen left they page to the next SECTION of the collectionView
Also in the toolbar below the collectionView I want the buttons when tapped to take the user to the particular section of the collectionView too. And if the user swipes left to a new SECTION the corresponding button in the toolbar under the collection view highlights also.
Thanks

Use this option:
collectionView.isPagingEnabled = true
Note that the size of each page is the size of frame which you set as the frame of collectionView

Related

Swift collectionView hiding layout guidance

I am looking to create a certain layout with a collection view. Where there are 2 sections to the main viewController, the first being static on the page, and the second being a collectionView which moves over the other when the user scrolls. I want the collectionView to have a limit of how much it cover the static content (it should have a minimum and maximum inset that it can covert). The collectionView has a button which "hangs over" the static section. I have attached some images to describe this further.
I have thought of a few ways to achieve this, the most promising being a collectionView with a top contentInset of the 'max scrolled down' height. This would show the content underneath and allow the collectionView to be scrolled up and cover it. the button which "hangs over" would be a subview of the collectionView and would also show the rounded corners and drop shadow.
Problems:
couldn't continue scrolling the collection view whilst also pinning the header to the top
If anyone has any suggestions of how to go about this, please let me know! Thank you.

UIWebview inside uitableview and scrolls contrary to the uitableview's scroll

I have UIWebview inside a UITableview.
I want when my tableView scrolls to bottom of the screen and when we reach the cell of UIWebview, my webview scrolls content to top in order to show its content to the user.
so the webview should scroll its content automatically when mytableview scrolls .
UPDATE : Explanation
In fact, this is my problem :
I want that my webview (which is inside a cell indexpath = 2) scrolls to top so we will have its y negative value in order to show its content while the tableview scrolls to bottom

IOS Swift TableView: Is there a way to move first cell one row down

I'm trying to make a fullscreen tableView but also have some space at the top when the viewcontroller first appears for a searchbar which disappears when you scroll the tableView, right now I'm hacking it by making an invisible cell at top, however is there a way for it to do so that only when you first load the viewcontroller, the first cell is about one row lower but can still scroll up to reach the full height of the viewcontroller, so the top of viewcontroller when you scroll back to top?
This is what I have right now:
The issue I'm having right now is that the invisible cell creates a huge empty space when u scroll down, see below:
As I understand you don't want the search bar to stick at the top of your view, so it must be in one of the tableView Cells, if this is true if you want to have an empty space under the search bar you can have another custom cell which you can customize its height in tableView(_:heightForRowAt) function.

UICollectionView scroll whole page

I have a viewController with some text and under it a UICollectionView (about 50% of the page).
My problem is that when I scroll on the collectionView just the cells are being scrolled and not the whole page (the text + the collection cells).
You can think about it like on Instagram profile page (half info half collectionView), when you scroll on Instagram everything is being scrolled and not just the collection cells.
Anyone knows how can I do it?
Thanks!
Add the text content as separate cells on top of the UICollectionView.
Preferably, create a different section which would contain the cells with the top text.
Keep the backgroundColor/backgroundImage of these cells plain to give the effect that they are simply added as UILabels on a form. Doing so will also differentiate from the rest of the actual UICollectionViewCells.
Now, when you scroll the UICollectionView. It will give an effect that the text along with the cells are scrolled.
In Attribute inspector > Scroll View > check Paging enable
Thats because your text/UILabels doesn't belong within the UIScrollView of your UICollectionView, thus it will not be scrolled when the collectionView is. You could create a UICollectionViewCell for your text, include it within your collectionview and expand the collectionView to fit the screen or use a UICollectionViewController

How to scroll or prevent scrolling in UICollectionView using swift?

I have a UICollectionView with one section, 10 cells and horizontal scrolling using a Flow Layout.
One cell occupies the entire screen, and has a UITextView and two UIButtons.
How can I prevent scrolling if no button in the cell is selected, and if it is selected, how can I scroll to the next cell on a UIBarButton click?
I would also like to preserve selection in order to be able to go back to the previous cell and change the selection if needed.

Resources