UITableView - centering of Sections - iphone

I am using a table view with its style set as "Grouped". I have only 2 sections to be displayed in the table view and the table view does not occupy full iPhone screen (It has some other views with it). So I would like to display those 2 sections centered in the table view rather than displaying the sections from the top of table view.
One round about way is to set header and footer of the table view appropriately. But the disadvantage of this is, each sections will be equidistant (looks awkward!). Anybody with solutions to it?
Thanks,
Raj

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.

Customize empty cells in a table view

I have a table view in which I would like to change the backgrounds of the cells. This can be done by subclassing UITableViewCell and setting the class of the cells in Interface Builder but this will not change the background of the cells used to "fill up" the table view. E.g. if I only have eight cells, then nine cells may be added to fill up the table view with cells.
Is there any way to change the background of these empty cells?
EDIT
This is not an issue regarding static table views. This applies to all table views. How to customize the background of an empty cell?
What I really wanted was to replicate the look of the iPad Settings app. I realized that Apple just hides the separators and does not set a background on their "empty" cells. This is what I ended up doing.
Setting a footer on the table view and then setting the height of this footer to 0.1f will hide the footer and not show any cells below it.

Shrink UITableView to accommodate another small UIView

I have a UITableView inside of a UIViewController.
I want to shrink the length of the table view dynamically in the code so that when I click on a row, a view slide down from below and covers a small part of the view form bottom.
Using core animation I am able to slide a UIView from below on top of the table view but I want to resize the table view so that the new UIView that slides from below does not obscure any of the rows in the table view.
I tried changing the height of the frame of the table view but its not working.
Any ideas what am I missing here or what are the common ways to do it?
Thanks
Simply setting the correct frame on your table view should work :-)

UITableViewCell to cover the entire screen in Grouped mode?

Is it possible when a table view is set to grouped mode to have a special kind of cell that covers the entire table view width?
Are you sure you don't want to do a regular table with the top and bottom cells having a custom background that gives it a rounded corner? (This would be easier than trying to force a grouped table view into something it isn't meant to be.)

How to decrease width of table view cells for iphone

I'm trying to create a grouped table view with two sections. For the first section I would like the width to be only half the screen. For the second section it would be the standard width. Also, next to the first section I would like to put a button.
How is this done?
Thanks!
To put a button in a section what I've done in the past is create a section that has no rows in it. Then, I respond to the - (UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section method with a view that contains a button that is rigged to whatever delegate I need. This will give you the appearance of having a button sitting in a section with no data. This is how buttons appear in the Contacts view/edit screens in the stock iPhone apps.
Table view sections are fixed with to the size of the screen. If you want the individual cells to appear narrower in one section and wider in another, then you can control the size of the view itself with the data source delegate, though you might have to set the background of the table view to transparent so users can actually see the smaller view on top of the table view.