How to add customized cell in tableview when user selects cell - iphone

I want to add my customized tableviewcell in my tableview when user selects a cell I have some buttons on that customized cell and want to give user option as soon he selects a cell.
Any suggestions and guidance to move on from here?

you have to use customize cell when cell is created and change the image of the cell when it will selected.

Create two custom cells, one for the normal rows and other for the required row. When the user touches a particular cell, you can record it's indexPath and reload the tableView. When the cellForRowAtIndexPath is called the second time after tableView reload, you can identify the row with the flag set earlier. You can then create a new cell for it.

Related

How to change the outlet of the TableViewcell when table is reloaded

Im making anApp which has a address which has a listing page and a detail page .
If i click on email address of the detail page , it pops to the listing page. i want to show a tick on the listing page whose email is selected.(like shown below). The cell has a image (tick)
.I want change the outlet of the image in the cell when the lising page is reloaded. The cellforrowatindexapath is obiously not called when table is reloaded.Is there any way that i can get the index path of the cell .so that i can change the outlet of the cell when table is reloaded.Thank you....
Why don't you change the accessory view type?
Set the accessoryViewType property on UITableViewCell to one of:
UITableViewCellAccessoryDisclosureIndicator
UITableViewCellAccessoryDetailDisclosureButton
UITableViewCellAccessoryCheckmark // you want this one
The default value is UITableViewCellAccessoryNone.
You may have to called [tableView reloadData] when appropriate to reload the table data.
There are lots of questions on SO relating to accessory views, e.g. custom accessory views: Using a custom image for a UITableViewCell's accessoryView and having it respond to UITableViewDelegate for example.

how to center uitableview selection with indexpath value

I am saving the indexPath selection from a subview and passing it to the parent view with delegates. When I got back to my subview from my main view I pass the indexPath back to it and show the user which cell they previously selected with a tick in the accessory view of the tableviewcell.
One problem being if the user has selected a cell out of a fairly big list its hard to find the cell they selected again incase they wanted to change it (being that they made a mistake)
I would like to know if their is a way to use indexPath or something similar to center the previously selected cell of the uitableview to the center of the screen?
UPDATE::
Here is a graphical view of what I am trying to achive to make it abit more understandable..
step one : select cell then go to subview and select the cell (value) you want to pass back to main view (save indexPath of selected cell)
step two: user either wants to change his selection or made a mistake and was ment to select the cell below the one they chose... repeat previous steps but display previously selected cell in the center of the view..
Have you tried the following function
[tableView scrollToRowAtIndexPath: atScrollPosition:UITableViewScrollPositionMiddle animated:YES]
a UITableView is a subclass of UIScrollView - try setting the Content Offset (figure out how much with the cell height and indexPath).
[tableView setContentOffset:CGPointMake(0, indexPath.row*cellHeight) animated:YES];
should work. You might want to do the math a little differently.

iphone sdk stay the selection colour of cell in UItableview?

How to get the selection cell still in the selected state in uitableview. Actually I am pushing a view from a tableview when came back then the selection cell is deseleted. I want to be show the previous selection cell when came back also how to do that.
In didselectrowatindexpath use the method selectRowAtIndexPath:animated:scrollPosition: and the row stays selected.
when you are going and coming back from anotherview make sure that save the selectedCell and then in viewwillappear method reloaddata.In cellforindexpath write the code of selection style uitableviewcellselectionstyleblue.
first, you can store the selected indexPath in user default in the didSelectRowAtIndexPath method.(maybe you can store a indexPath that is bigger than your table view's row count to indicate initialization stage, which means that no row has ever been selected)
then, you can load the stored indexPath in the viewDidLoad method using
tableView selectRowAtIndexPath:<#(NSIndexPath *)#> animated:<#(BOOL)#> scrollPosition:<#(UITableViewScrollPosition)#>
meanwhile, you can do some check (like mentioned above or something else) to check if there's nothing selected yet.(saving a bool in user defaults works, too)

It's possible to make a uitableviewcell draggable

and I want to make the tableviewcells draggable, but outsite the tableview.
Is this possible?
I don't believe you can make drag the cell outside of it's containing view, but it is possible to create a view on top of the tableview and drag that where you want it. You'd probably want to delete the cell from the table as soon as the user selected the cell to make it look like he grabbed the cell from the table.

TableView as seen in "Addresses"

every iPhone and iPod Touch has got the Apple "Addresses" App ... when you create a new record, there is a tableview. The first line contains an button (to add an image) and a tableview cell.
How would I do such a tableview cell with a button and a regular cell in one row ?
Thanks a lot !
Sebastian
It's not a button and a regular cell. It's one custom cell with two custom subviews the second of which is made to look like a standard tableview cell.
Just make a tableview cell that looks like you want (either in interface builder or programmatically) and return it as the cell for section 0, row 0.