How to enable Horizontal paging for each Section in UITableView - swift

I was using an app the other day which appeared to separate its UITableView sections (events for each day of the month) into separate PageViews. Here is a gif of the functionality: https://giphy.com/gifs/3ohBV4yNhpYOFoURxe.
When I tried using a page view to accomplish this it seemed that you could only use separate ViewControllers for each page, rather than different sections.
Any idea on how one would go about doing this? I’m at a loss.

You can do that by using a collectionView as reusable tableView cell, which means, sections and cells from your tableView can be a collectionView. And then you set your collectionView cells as big as the example.

If you would like to do this in one UI element, use UICollectionView.
UITableView appearing and interactions are very limited.
this could be a good starting point:
https://www.raywenderlich.com/156794/custom-uicollectionviewlayout-tutorial-parallax

Related

TableView with different cell types or ScrollView with inner TableViews

I saw many stackoverflow questions, but I could not come to a definite answer.
I need to create the following screen (detailview):
It's wide ScrollView screen which contains among other custom UITableViewCells of different types.
NewsCell and SongCell - are two custom UITableViewCells classes, which appear differently.
How to properly implement such a screen?
Option 1:
Use UITableViewController and UITableVIewCells of different types:PhotoCell, DescriptionCell, NewsCell, SomeTextCell, SongCell.
Option 2:
Use UIScrollViewController, which contains other elements (Image, Labels, UTableView for news and UITableView for songs. (But I read that insert UITableView into UIScrollView it's wrong, because UITableView is subclass of UIScrollView)
Option 3:
Something else.
Waiting for your comments!
Create multiple custom cells and start integrate into your tableview. If you want to show the cells based upon the content you can calculate the internal elements size and take the highest element hight and make the cell height. Now you can observe that cells will display based upon the highest element hight.I think it will full fill your requirement.
If there is a pattern like a header followed by few cells, then you can use sections which is a feature in uitableview.

Newbie TableView challenges

I am building an app that requires a tableview control so that users can select multiple rows and act upon them in some way. I find it easy to load my data and display it using the UITableViewController but it seems when I do it this way I am unable to place any other controls on the page, such as a toolbar to give the user some actions to perform on the selected rows. I can place a toolbar control on the form in the storyboard, but it doesn't render in the emulator.
Using a UIViewController and placing a TableView on it seems to come with its own set of confusing challenges (that will make total sense once I conquer them).
Is there any advice for a smooth way of getting a table view with toolbar controls? Thanks!
don't use a TableViewController. Use a Standard ViewController, then add a UITableView to it, and adjust the size. This way you will be able to do whatever else you want on that view without limiting yourself to the tableView only functionality.
When you do this make sure you add the datasource and delegate to the connected table. Then add cellForRowAtIndex, number of sections, number of rows, and whatever other delegate methods you need for your table.
Good luck
Is there any advice for a smooth way of getting a table view with toolbar controls?
Yes there are few ways to accomplish this, one way would be adding a footerview to your tableviewcontroller check these
http://developer.apple.com/
UIButtons on tableFooterView not responding to events
Easier way to add this is using storyboard.
Just drag and drop a view in to your tableviewcontroller, then you can adjust the views size and put anything from objects menu to inside of the view.
Now the problem with that is view will not be stable position at the bottom of the page like a tabbar. Lets say you have only 1 row in your tableview, footer view will go up just below that 1 row, lets say you have hundreds of items in your tableview toolbar will be at the bottom of the rows.
The other solutions for your problem would be either create a custom view and adding it to current view or window (this is little bit adbance),but if you want this just google it.
Or just as you said, create a viewcontroller and put a uitableview inside. Dont forget to add <UITableViewDelegate,UITableViewDataSource> to your .h file and then you can call UItableview delegate methods.\
Good Luck.

How can I make the first and last UITableView cells stay on screen when scrolling?

I have noticed in the iTunesConnect iOS app, the first and last cells of the grouped UITableView stay on screen even though the other cells are scrolling through them. They also move with the tableview. For example when scrolling to the bottom of the table (moving up), the last cell moves up with the table as it leaves the bottom of its position on screen.
Does anyone have an example of how this could be done? I have tried setting the header and footer views but these scroll off screen when moving the tableView.
Thanks.
I think the best approach would be to use a plain UITableView with Header and Footer set, and "skin"/theme your custom UITableViewCells to look like grouped UITableViewCells.
you'd might want to have a look over here for some pointers on how to achieve this.

reorder cells dynamically through code(without dragging cell) with the animation

I have sorted data coming from server and I am displaying it on tableview, however, there is a another functionality on cell, that If I do that functionality, cells should be rearranged accordingly.
I want to have animation like reordering cell using reordercontrol of table view cell.
Does anyone know, how to animate like reordering cells?
Check this post at Matt Gallagher's blog Cocoa With Love.
It has a great project that shows how to animate rows and a lot of cool stuff about customizing UITableviews.

Reordering UITableView sections on the iPhone by dragging (like reordering rows)

Is there anything currently in the SDK that allows for re-ordering of tableView sections? As in, move the entire section below or above an adjacent section? This is plausible with individual UITableViewCells. Haven't seen it done for sections though.
Maybe not ideal but fairly simple so worth considering:
Add Up/Down buttons to your section headers. Down on the first, Up on the last and Up and Down on all the others. Then respond to the button presses by programmatically re-ordering the table. Up moves the section up one and Down moves the section down one.
Martin
There's no built-in touch-responsive API for moving table view sections - you'd have to do it programmatically then send a [tableView reloadData] message or similar.
It is concievable, though, that you create a table view where each UITableViewCell's view is itself a UITableView containing a section of your data, so that the cells in the "master" table are draggable as UITableViewCells. This would let you reorder "sections" in your table, but they wouldn't be sections anymore - they'd be separate tables, each with a single section.
Maybe as an alternative idea, reloadData on the table to only show the sections as a kind of "collapsed all" view on your table (maybe it is possible to even animate this?) which then has one section, containing all sections as row elements. The only extra required would then be a button that will set your table to this state.
I tried to move rows from one section to another, while updating the datasource of course. But this seemed to be mission impossible. Empty cells in between, wrong contents in sections, wrong ordering of sections were the only results I got.