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

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.

Related

Check for section index titles from table view cell

I have subclassed UITableViewCell and I need to draw my own disclosure indicator. The position of the disclosure indicator depends on whether or not the table view has section index titles set (the "scroll bar", typically the alphabet).
Does anyone know of a way to check if the table view shows section index titles from the cell?
Checking this from the UITableViewCell subclass would require a big deal of coupling with the UITableView class, so I suggest you take an alternate route - add a BOOL variable which you set in the cellForRowAtIndexPath: function and then call a function on your cell that will draw the disclosure indicator according to the value of the variable.

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 - changing contents of a UITableViewCell inside a navigationController

I have a UITableView with some cells in it that have people's names. When the user clicks on a cell, the Navigation Controller pushes a new view onto the stack that shows detailed info for that person. When the user is done and clicks the button to return to the previous view, the tableview is again shown. The problem is that I want to edit the cell text (or just mark the cell in some way) to show that the user has clicked on that cell. In my cellForRowAtIndexPath: method I have set up code that should change the text of the cell after a user clicks on that cell. I set up break points and it IS entering cellForRowAtIndexPath: when the detail view is popped and the tableview is again shown. It's entering the segment of code in cellForRowAtIndexPath: that should change the text, but when it comes up on screen, the text has not been changed. Does anyone have any ideas as to what is going on? Thanks.
EDIT: I figured it out. I just needed to call [tableView reloadData]; instead of calling the cellForRowAtIndexPath method. Not sure why that works differently, but it fixed it.
I guess I'll help you out. You don't need to credit me with the answer though.
cellForRowAtIndexPath:
that method is called within the framework when a cell is being refreshed from the queue or when it needs to be created. You should not call this method.
[tableView reloadData];
that method is basically a refresh on all of the visible cells show in the UITableView. This is the method you should call if you change information in your data source or you need to (force) update the appearance of your cells.
It's Good You Have Reload Table And Changed The Text But If YouJustIndicate NAd Don't Want To Change The Text The nYou Can Use elow Given Text ....
[cell setAccessoryType:UITableViewCellAccessoryCheckmark];
It Will Check Mark Particuler Cell Which You Click/Visited......
Hope You Like This Solution.....

Allow input in a UITableViewCell

So I have a UITableView (its in a UIPopOverController if that matters), and I want the user to be able to edit the content of the tableView. I added a UINaviagationController, the tableView also has a title and an edit button. Essentially what I'm asking is, when the user taps the edit button, how can I add like UITextViews to some of the tableViews and in one of the cells, a UISegmentControl and a UITextView.
Thanks in advance
just add them as subviews of the cell, set correct frame to make subviews inside the cell

How to add customized cell in tableview when user selects cell

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.