Multi Column header for a UITableView with Multiple Columns - iphone

I have created a UITableView with multiple columns to display a Football League Table. Now what I really need is a header to label each column which will ideally sit at the top of the table view. How would I do this?

Instead of setting it as the header for your first UITableView section, it would make more sense in your situation to set it as the header to your entire table. This can be done with the tableHeaderView property of UITableView. For example:
UIView *myHeaderView = ...
[myTableView setTableHeaderView:myHeaderView];

You could create a custom UIView and set it as the first section header of your UITableView. Return it in your UITableViewDelegate's tableView:viewForHeaderInSection: method. You simply need to design it so that it aligns with the "columns" inside your custom cells.

This is sort of a weird interface for an iPhone app, assuming you are trying to replicate the look and feel of an HTML table, with headings, cells and etc.
If this is what you want, why not just use a UIWebView object to display your table?

Related

how to create a sectioned TableView for profile in iPhone

I saw this picture on Internet:
the section with the add Photo Frame and two rows (First, Last)...
How do you achieve a design like that!!!
I only know how to make rows (static and dynamic) in xCode using the full width of the screen but not in a single section but not making such a divisiĆ³n and adding a frame out of the other two rows
my designs are like this
Any help I'll appreciate
thanks in advance
It's not really clear that the example you've given is actually embedding the first, last part into a table view. It could just as easily be a single cell that has embedded views with borders to look like rows. Here are a few ways I see to accomplish the view you've given.
Have them be actual rows - but use a custom cell layout that offsets the 'First' and 'Last' labels to be further to the right. Then create a UIImageView for the profile that sits on top of the UITableView cells, but inside of it. Basically insert it as the first subview of the UITableView. It should cover the top left of those top two cells. You can do this since those cells have a static known hight and you've set the left offset. Another option would be just inserting it into your top cell, but having it overflow the bounds and setting clipsToBounds = NO.
Make the entire top view a custom UIView that uses CALayers or CoreGraphics to manually draw the lines and layout such that it looks like part of the table view. Set that as the TableView header, or the first section Header.
There are a lot more things you can do like changing frame layout as well.
you can achieve this with the use of xib read carefully and if you don't understand anything you can ask me again it's bit tricky
in you xib create a UIView and design for your photo and firstname, lastname cells with the use of textfields image views and all and then take a UITableView.
now drag your UIView and drop it on your UITableView so that it will be considered as your table header and your first section now will be as you designed like photo with firstname and lastname fields.
i've done this in manier projects of mine so hope this way you can also do this thing and ask me if you need any help.

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.

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....

Set a grouped UITableView to start at a given section?

I have a grouped UITableView that has basic data inside it, but I would like to start the UITableView at a certain section when the app loads, can this be achieved?
Thanks
Mark
Sure - use the scrollToRowAtIndexPath method of UITableView. Using the index path you specify which section and which row you would like to scroll to. Presumably you would like to see it at the top of the table so in the method call specify UITableViewScrollPositionTop.

Multiple images per row in UITableView's cell

Is there any sample code that would illustrate how to have multiple images within each row?
Typical apps show a thumbnail to the left side with text to the right. I'd like to do that plus an image to the right of the text.
How would I go about doing this?
In interface builder, simply create a tableview cell that looks like you want. Then create a UITableViewCell subclass that has properties pointing to the elements of the new cell. Set the class of cell to the subclass then add cells of that class to the table in the standard way.
A tableview cell is just a view and you modify it and use it just like any other view.
You'll have to create a custom UITableView cell. Here's an example of using multiple UILabels in one. Here's another.
Pretty easy - follow Apple's documentation to create exactly the cell you want in Interface Builder with as many UIImage or whatever else you like. Look at Table View Programming Guide for details on how to make and load the custom cells - just be careful about performance when you put a lot of visual elements in a table view.