ios
ios

Reputation: 552

refresh table view after remove subview in iPhone

I have a table view and when I select any row then add a view as a sub view. In sub view I have a button. now I want that when I click on that button then my subview will remove and table view also refresh and some data of main view will also updated.

Upvotes: 1

Views: 1071

Answers (3)

Dzy
Dzy

Reputation: 153

when you touch on your button , use the following methods:

[yourView removeFromSuperView];
[yourTable deleteRowsAtIndexPaths:[NSArray arrayWithObject:indexPath]      withRowAnimation:UITableViewRowAnimationRight];
[yourTable reloadSections:[NSIndexSet indexSetWithIndex:index] withRowAnimation:UITableViewRowAnimationFade];

Upvotes: 0

Romit Thakur
Romit Thakur

Reputation: 64

Use Delegation. Remove sub view and call delegate method and use [tableView reloadData]; in delegate method.

Upvotes: 2

Nuzhat Zari
Nuzhat Zari

Reputation: 3408

You can do it in various ways:

  1. You can use delegate.

  2. Reload tableview in viewWillAppear.

Upvotes: 2

Related Questions