there is a button in the last row of the tableview, when press it, I want the button in that row disappear, at the same time, add more rows, then, the button appear in the last row again.
but I do not know how to make it!
here is my code:
- (void)morePicture:(id)sender{
NSMutableArray *indexpath = [[NSMutableArray alloc] init];
[photos removeObjectAtIndex:[photos count]-1];
[indexpath addObject:[NSIndexPath indexPathForRow:[photos count]+1 inSection:0]];
[table beginUpdates];
[table deleteRowsAtIndexPaths:indexpath withRowAnimation:UITableViewRowAnimationNone];
NSMutableArray *indexPathss = [[NSMutableArray alloc] init];
for(int i=0; i<3; i++){
NSString *s = [[NSString alloc] initWithFormat:@"%d",i];
[photos addObject:s];
NSIndexPath *indexpath = [NSIndexPath indexPathForRow:i inSection:0];
[indexPathss addObject:indexpath];
}
UIButton *moreButton = [[UIButton alloc] initWithFrame:frame];
[moreButton setImage:[UIImage imageNamed:@”button_signin.png”] forState:UIControlStateNormal];
[moreButton addTarget:self action:@selector(showMoreRows) forControlEvents:UIControlEventTouchUpInside];
// Add button to table footer view
self.tableView.tableFooterView = moreButton;
And in method
-(IBAction) showMoreRows {
// Add object in array which is responsible for creating table view and then called
[self.tableView reloadData];
}