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

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.

Related

Is it possible to do that with vertical scroll collection view or table view ?

Can somebody give advice about this ? I prefer the vertical scrolling.
Since it's android and I can't really post entire code, you can probably look at this link for help -
http://sdroid.blogspot.com.au/2011/01/fixed-header-in-tablelayout.html
I would suggest going for table view since collection view is generally for grid layouts. Since your layout looks more like a list of items stacked in one column, table view will be ideal and a little simpler. If you want more complex layout Collection view is much better.
According to apple docs -
A table view displays a list of items in a single column. UITableView
is a subclass of UIScrollView, which allows users to scroll through
the table, although UITableView allows vertical scrolling only. The
cells comprising the individual items of the table are UITableViewCell
objects; UITableView uses these objects to draw the visible rows of
the table. Cells have content—titles and images—and can have, near the
right edge, accessory views. Standard accessory views are disclosure
indicators or detail disclosure buttons; the former leads to the next
level in a data hierarchy and the latter leads to a detailed view of a
selected item. Accessory views can also be framework controls, such as
switches and sliders, or can be custom views. Table views can enter an
editing mode where users can insert, delete, and reorder rows of the
table.

can I show an index for UITableView (ie sectionIndexTitlesForTableView) without a searchbar?

I am trying to make an bunch of links on the right side of the uitableview to jump to the various sections in the tableview without having a searchbar at the top.
thanks
Sure can. Just implement a couple of methods in your table view’s data source: -sectionIndexTitlesForTableView:, which should return an array of titles, and -tableView:sectionForSectionIndexTitle:atIndex:, which returns the corresponding section once the user clicks on a section title.

multiple cells in one row

I have read a few posts about what I need but I can't manage to do this.
I want a table that could be set up like an image, it will have a regular background image and from half the screen to the bottom i want the table view to have 6 different cells
How can I do this. I have done this with buttons and my app is working with no problems, but I wanna do this with table also
Why dont you use AQGridView. Its an extension of uitableview and you need not worry much about other things.
Spire you can easily add six buttons in one table row or three buttons in one row (two rows then). You can easily assign tag number (based on indexPath.row.. like indexPath.row + 1, indexPath.row + 2 ...etc). and in there action method you can use these tag numbers...
to create customized cells follow these links -
http://adeem.me/blog/2009/05/30/iphone-sdk-tutorial-part-6-creating-custom-uitableviewcell-using-interface-builder-uitableview/
http://www.e-string.com/content/custom-uitableviewcells-interface-builder
The image doesn't look like a table view. It should be a custom view. UITableView can contain single UITableViewCell per row. If you still want to create a table view like that, you have to customize each cell to have three different views like that.
If you don't want table view, you should customize your view to achieve something like that.

Enable scrolling only for one section in UITableView

I have a two sections in my table view. First contains two rows, and second much more.
I need scrolling only for second section. Is it possible?
No. A table view is just one big thing.
If you want to have the first section static on-screen, you might want to put it outside of a table view after all, or split your table view into two separate table views.

buttons in a table header to load tdifferent table views

What's the best way for me to add 2 custom buttons in the header of my UITableView?
On clicking either of those buttons, a different table View is loaded.
Thanks for the help!
Add the two buttons to the header, and use the IBActions of those buttons each to set the datasource to an other array. After that, use [tableView reloadData];
If you want to use buttons above the table, I'd suggest either using sections if your having no sections in your original table, or placing a toolbar above your table.
UISegmentedControl is pretty much for this purpose, then you can hook the events and switch the views accordingly... It looks better tan two separate buttons, and also better from the user experience perspective...
Second choice is to have two different tables or one table with two different data. I would prefer two tables, each having its own data, and delegates. Easier to write cell rendering code and all...
If both data are of the same type like "Array of MyObject", then you can come away with just a flag and some ( flag ? firstDataArray : secondDataArray) type of selections in the table delegate methods.
First add two different customs button and then add two different table Views bellow that custom buttons.
Use a separate UView and add both UIButton as subview into.
Then add this button's view in the parent view of your UITableView
Then both the button's view and UITableView will be the sibling view....