How to relaunch updated table? - iphone

In my application, I fetch contactInfo from address book and this info populate on the tableView. when i check row using checkMark, then data delete and send on server. Left some data, which is unchecked.
Now After then I need unchecked data show me on tableView ,whenever i relaunch my application.
Thanx
Mishti

Call [tableview reloadData] function to reload the table.

Related

tableView not updating after adding Core Data object

Given this Core Data Model: Photographer <-->>Photos.
After adding a Photographer via a Modal View, the tableView of Photographers updates accordingly.
The problem is, that it doesn't do the same for Photos. I can add a Photo via a Modal View, and the tableView of Photos for that particular Photographer does not update immediately. Once I navigate back to the tableView of Photographers and select the same Photographer again, it updates as expected.
How can I get the tableView of Photos to update as soon as the Modal View(where the user added the object) gets dismissed?
Where modal view dismiss try to use:
[tableView reloadData];
Try
[tableview reload];
method after getting new data.
Check your error variable if it contains an error.
You directly assign the result of -executeFetchRequest:error: to an ivar (photographerPhotosArray). This either leaks or causes an immediate release.
Consider switching to NSFetchedResultsController since it helps you a lot.
Check your array first is it fill or empty? try with NSLog and check it. if it exist then reload your table

table view data update in objective c

in my iphone app i am adding data to table view on click of button but its not getting updated.It ll update only if i reopen the app.
Use [yourTableView reloadData] to tell the tableview to reload its data and be updated.
Use the [tableView reloadData] method on button click after updating the table view's data source.
So something like this:
-(IBAction) buttonPressed:(id)sender
{
// Update data source of table first
[tableView reloadData]
}
Also check this out: UITableView reload data
try [tableview reloadData]
in wiewWillApear method
Preview Controller to reload its data from its data source.
- (void) reloadData
The display is recomputed only if the current preview item has changed.

Deleting rows UItableview iphone using userdefaults

I need your help, maybe its something silly but I can't find the error.
I have a table view and an add button, when its clicked I show a modal view with a little form, when save button is pressed I send the data to the TableView controller to show it, also I'm using NSUserDefaults to save this data in an array.
My problem comes when, for example, I add 2 new rows and delete 1 of them, then when I add another, it shows the last row I delete instead of showing the one I just add.
I'm doing the saving and reading this way:
in viewDidAppear I read the NSUserDefaults and get the data if exist.
in the method that catches the data from the ModalView I save to userdefaults.
in commitEditing method I read userdefaults and then delete the row from the array and from the table and then save this change in userdefaults.
I don't know what I doing wrong, Can anybody help me with this?
Use [self.tableView reloadData]; in the viewWillAppear of that class. You can also reference that class in another view controller, create an object for it and call [classObject.tableView reloadData];
Always remember to reload the tableView after an add operation or a delete operation.
Don’t use NSUserDefaults to act as the direct datasource of a table. Store it in an intermediate model. It’ll be a LOT easier to debug that way.
If you’re having trouble keeping your model synced with the user defaults, call [[NSUserDefaults standardUserDefaults] synchronize] whenever you alter them.
Also, make sure you’re not making some mistakes in your table cell reuse. You might be seeing old data if you have a customer UITableViewCell class and you’re not correctly implementing -prepareForReuse.

can I reload UITableViewController with out reapearing or reloading the table

I am developing an app in which I have to delete the contacts from table ,problem is that when i delete one contact ,I have switch from one view to another then I can see the changing b/c i put the reload method in viewAppear any suggestion?
In general you should avoid to use reloadData to refresh the content of a UITableView, you should only do it if you can't avoid it (ie you replace everything in your table) or the user won't see it (ie in viewWillAppear).
I would suggest to use insertRowsAtIndexPaths:withRowAnimation: to insert single rows and deleteRowsAtIndexPaths:withRowAnimation: to remove rows.
So you get the indexPath of the row when you delete a contact and call [tableView deleteRowsAtIndexPaths:[NSArray arrayWithObject:deletedIndexPath] withRowAnimation:UITableViewRowAnimationFade]
Those details make the difference between a app and a good app.
you can call [self.tableView reloadData]; to reload the table view by staying on the current view.
You can immediately reload table after deleting the contact !
Just call [self.tableView reloadData] in the UITableViewController after the data has been modified. This will update the table view to and reflect the new state of the data.

Adding and updating table view simultaneously

I have an array whose contents are updated and new entries are added on every seconds. How can i show the contents of an array in a table view so that i can see the newly inserted rows and updation of the added row.Can anyone help me.
Thanks in advance!!!
The answer suggested; [theTableView reload] definitely works fine. If you update the table every view seconds, however, your users will hate you.
Try to capture the reloading data in a notification handler. In that handler, check if the updated data belongs somewhere between the currently visible cells, if so, update the currently visible view. If not, ignore the updated data (but do add it to your underlying model). If the user scrolls further, after your update, cellForIndexPath: is called and the updated data will be drawn automatically.
reload is quite heavy to do every view seconds, certainly with a lot of data. drawing might get screwed up or worse..
You need to do a reload every time your datasource is updated. So if you table view is theTableView you would execute this instruction after your array is updated:
[theTableView reload]