UITableView custom plain gray index - iphone

I really need to implement a set of gray index bars for my app.
Currently, I'm using a UITableView which I split off into multiple sections.
However, the default section indexes have a gradient appearance which I think is undesirable.
Is it posssible to change the indexes to have a custom appearance such as a plain gray appearance?
If so how? Thank you!

You can implement your custom "index view" ( section header ) by using these tableView delegate or datasource (I'm kind of blur) methods.
- (CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section;
- (UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section;

Related

Indexed UITableView without section header

I'd like to implement a grouped and indexed UITableView without section headers.
I'm using sectionIndexTitlesForTableView:(UITableView *)tableView to return my titles.
I also implemented tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section and returned nil as well as tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section and returned 0.0f.
Both doesn't remove the section headers. There is still a space between the different sections.
I had the same problem and could not find a solution. In the end, I had to subclass UIViewController (not UITableViewController) and use a UITableView with transparent background and the style set to UITableViewStylePlain. Then, I created custom cells for the first and the last row (with rounded corners) and some transparent margin left and right. I can give you more details if you want, but as it does not answer your question straight, I'll just share this link for now.

Custom Section Title View for UITableView

In some apps such as Cool Iris, LiveShare, i see them using custom views for their plain UITableView section titles. Is there a way to replace the standard section title bar with a custom view?
In order to customize the look of your section header, there are two methods you will probably want to use.
- (UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section
and
- (CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section
These are both found in the UITableView delegate protocol. The first will let you create a custom view to display as your section header. The second just makes sure you get the size you want for it so that your view doesn't get cut off

UITableView Implementation

in the screen shot below, there are UISegmentedControl in between grouped UITableViewCells...it seems. How does one add other controls in between grouped cells in a UITableView?
You could make the Segmented View the same size as 1 table cell. Dead Simple to do in Interface Builder.
Tables with multiple sections, and sections can have custom header and footer..
- (UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section; // custom view for header. will be adjusted to default or specified header height
- (UIView *)tableView:(UITableView *)tableView viewForFooterInSection:(NSInteger)section; // custom view for footer. will be adjusted to default

Displaying a UITableView followed by an image, followed by more UITableViewCells

I've seen some applications on the iPhone have an image on top of the tableView, which is straight forward and can be set with something like tableViewHeader.. and a picture below set with tableViewFooter. I recently seen an application where there is an image in the header, a table view, then another image below the footer, and then subsequently a couple UITableViewCells...
Is there a straight forward way to accomplish this without using two UITableViews in the same controller?
Multiple sections will accomplish this, you can also use this method on your UITableViewDelegate
- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath;
in conjunction with a custom UITableView cell created in
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
This will allow you to specify a custom cell with the appropriate height that contains your image.
Use 2 sections.

[iPhone]How to customize header of Section in grouped TableView?

To customize cell, we implement class inherit UITableViewCell. Now, to customize header of Section in grouped UITableView (same to below picture), how to do? Please guide to me!
Implement tableView:viewForHeaderInSection: in your table view delegate.
Starting with iOS 5 you also need to implement
- (CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section
In addition to
- (UIView *) tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section
Otherwise it won't work.
From Apple's reference
The returned object can be a UILabel or UIImageView object, as well as a custom view. This method only works correctly when tableView:heightForHeaderInSection: is also implemented.