Scroll one page up in UITableView - ios

I have a big list of items displayed using UITableView, having variable heights.
Suppose first visible item is item #1000, how can I programmatically scroll exactly one page up?
Or how can I scroll up %80 of height?

Select your tableview from interface builder. in attribute inspector check paging enable under the scrollview.
refer below screenshot!

Related

How to disable the scrolling of table view for first Section #iOS

I have two sections in my table view , I want to have scroll enabled for 2nd section and disabled for 1st section , how could I achieve it ?
A UITableView as a whole is a ScrollView so there is no way to only scroll one section. I'd suggest moving what is in the first section into a UIView, then placing a UITableView below that UIView that just has a single section that contains the views you had in the section of the view.
This way the top part will not scroll, but the bottom part will.
A way to workaround it is having 2 UITableViews, one with scrolling disabled while the other has it enabled.
You can disable scrolling on a UITableView on the Attributes inspector while it's selected. There's a whole section on the Scroll View the UITableView has, and in the second subsection there's a toggle for "Scrolling Enabled" which is on by default.
[Edit: I've just seen the other comment, and I'd still recommend 2 UITableViews if you are dealing with dynamic content. If the content from the 1st section isn't dynamic, you may use an UIView as it'll save a lot of time just by not needing to implement 2 UITableViews in a single UIViewController]
#vinay
Try this solution
Take a view at the top of view controller.
Below that view take tableview.
Set table style to Grouped. It makes sections of tableview scrollable.
In your case I would use Section Header for the second section and make that header as customView.
You need to call the following functions:
1) viewForHeaderInSection
if section == 2 {
... customize your header view
}
2) heightForHeaderInSection
if section == 2 {
... set height
}

How to adjust the height of my tableView when my dropdown menu is clicked?

I have a implemented a drop down menu above my UITableView and when I click on it I want my table view to go down inside the items of my drop down menu, because right now when I click on my drop down menu, the tableview stay where it is..
i have a view above my prototype cell that contain my drop down menu but I can't put any constraints on it... when I click in "filtre" I want this to happen : image description here
it looks like you added a Table Header view. it is a little different than common UIView.
Instead of changing Height constraints, you'd better to change the frame of the headerview
how-to-set-the-height-of-table-header-in-uitableview
In addition, you can found good codes of dropdown implementation from these links.
https://github.com/qmathe/DropDownMenuKit
https://github.com/onmyway133/Dropdowns

I want to see all the cells in static table view, which don't appear on the screen in the storyboard

I'm currently studying iOS programming in Swift. In creating a static table view, changing the Rows option more and increasing cells' height while designing them, there happens to be a problem:
The table doesn't scroll vertically in the storyboard. So it doesn't show all the cells I assigned in the Row option. I have more cells to work on. How can I handle this?
You can see by following way
Select the controller in the story board
Go to size inspector and make it freeform , then you can increase the height of main view and can see the full content.

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

Dock an item on top of UITableView like imdb app on ipad?

I want to do something similar to the left UITableView on imdb app on ipad.
Once you have selected an item, it will become the first item on the top and it will dock there. When you flick the list below, it will always be there.
Anyone has any suggestion on how I can achieve that?
That's not part of that UITableView.
It is a seperate UITableView with a custom UITableViewCell that is actually the same as in the UITableView with all the information about the selected film or character ...
When no film is selected, that second UITableView isn't visible. But as soon as you select an item, that UITableView at the top will become visible with the information about the selected item. That means that you will have to reduce the height of the UITableView (with the detail info about that item) so that the UITableView at the top will get some space for being displayed. Everytime you change the item, you need to update the UITableView using the general delegation and datasource methods for a table view. Once there's nothing selected, you just set the upper table view to hidden, and set the other table view's height to the full height.
That's all.

Resources