Is it possible to link a table cell - iphone

I wonder if it is possible to link a table cell in a tableview.
I have a tableview with two sections. The first section hold some address data in six cells and the second section has only one cell and this should call the google maps app when clicked. Is something like this possible and how does it work?

In didSelectRowForIndexPath filter on indexPath.section and indexPath.row. indexPath.section should be 1 (=second section) and indexpath.row should be 0 (=first row).
If both match you trigger the required action.

#crazer yes it is possible to link a custom table cell in your UITableView.....if i understant your problem well u need to print different data in two setions through custom table cell......that u will do through the conditions .......but u have to subclass UITableViewCell. For further information please follow the link (Table View Cells - Subclassing UITableViewCell).....http://www.bogotobogo.com/XcodeSDK-Chapter7B.html
Hope u got my point!! Good Luck

Related

iPhone UITableView - Visible Cells

I have a grouped UITableView, with cells in section 2 depending on cells in section 1. More precisely, each cell in section 1 is associated with multiple cells of section two and deleting a row in section 1 needs to delete the associated rows in section 2.
I have my dataSources all set up and everything works fine if all cells are visible. However, if the cells from section 2 haven't been loaded in the UITableView yet, I have a problem because the data source is updated for section 2 too.
I'm looking at this method visibleCells in UITableView. But I'm using custom UITableView cells and get an unrecognized selector exception if I try to access one of the labels in a cell.
How do I get around this?
Thanks,
Teja.
I believe what you were looking for is:
if ([tableView visibleCells] containsObject: theCellOfInterest]) {
// Do whatever you want to do.
}
Sorry if I wasn't clear the first time (or maybe even the second time too), but here's an answer to a repost of the same question.
Deleting multiple (not yet loaded) rows in UITableView

Best (Any) way blend tableview section header onto top of a grouped tableview

I'd like to add section headers to my grouped table view's sections but I'd like them to appear seamless (see image). The default, as we're all well aware of, is rounded top corners on the first row of a grouped table view cell so it ends up looking like crap when you merge them.
Any way to specify when indexPath.row = 0 that the UITableViewCell should use row style "middle" or something like that?
If not then what are my options? I guess I could scratch the section header and use Row 0 as a quasi-header then push my array data +1 to fill the rest of the table? I'd rather not roll my own from scratch...if possible.
Sample Table http://img35.imageshack.us/img35/8181/sampletable.png
Edit:
"Crap" looks like this:
alt text http://img25.imageshack.us/img25/9748/crapsection.png
Don't do what you're doing, it's against HIG
Ok, ok, I'll tell you how to do it:
You're going to want to do your own cell background views. The default grouped one is not what you want.
When a tableview asks you for a cell, set its backgroundView and selectedBackgroundView to something that looks appropriate for its place in the tableview.
Usually, this means a UIImageView with the appropriate image, though you can go wild here with a custom view, but there are gotchas.
So in your case, you would do
if (indexPath.row > sectionRowCount - 1) {
//Not the last row
//Put in the middle background
} else {
//Put in the end background
}
Then you'll want a custom table section header, but that's pretty easy.
In your case, you probably won't have to worry about when there's just one row, so that makes things even easier.
Take a look at the tutorial here:
cocoa with love basically what you need is 3 different images. One for the top row, one for the bottom, and a 3rd for the middle rows.
You could also not use the section header, but instead use a custom cell as the first cell of the section. So when ([indexPath row] == 0), return a custom cell that is the "header" and then return the "regular" cells (offset by one row) for the rest. You'll also have to make adjustments to the numberOfRowsInSection function to return +1.

Two cell in a row,UITableview

I want to have a two cell in a row,as in contacts we have “Text message” and “Add to favourites” in a single row how to do that….
Is that Splitting a cell into two?
can anyone help me?
For that you're going to have to create your own custom cell which contains two cells. Perhaps the easiest way to do that would be to create a cell which contains two buttons. It's somewhat a hack, but it's the easiest way.
If you go with that route, you won't even have to subclass, you can simply prepare your content view with the two buttons, and set that as the cell's content.

value in the Table view is repeating after the 11th row

I am beginner iphone developer I want created table in programatically. In the table we take more than 20 row. But i have some problem that after 11th row the same value repeated.
plz help me with code and other method
You may want to look at this question which is the same problem. In that case, the person was setting the text of the cell only when creating a new cell (when nil was returned from [tableView dequeueReusableCellWithIdentifier:].) It needs to be set every time the tableView:cellForRowAtIndexPath: is called.
when you use reuseIdentifyer, the new cell to display is the cell that has just disappeared. so it will contain all the data from the disappeared cell. for example, if the cell, that has just disappeared, has detailDisclosureIndicator, the new cell will have it too even you don't set it.

How do I set a custom cell for non databound TableCells

I am happily able to set the styling of my tableviewcells using the cellForRowAtIndexPath delegate, but I want to set the background of all the nonpopulated cells which are still on the screen
hey, basically any cell which is part of your tableview belongs to a particular index and particular row
so incase you are not populating a particular section via data source - you can still get a reference to a cell in that indexPath by manually calling the cellForRowAtIndexPath delegate, and passing the section as well as row index
it returns you a cell. assign it to your private variable and edit it the way you want to.
Use the visibleCells method on your table view. Then do what you wish to the cells.
Alternately, you could call indexPathsForVisibleRows to get just the index paths. Then call cellForRowAtIndexPath: to get the cell corresponding to each index path.