EDIT: Question in short: How do I access the index of the cell from the UICell class? Because atm I get it only from the method in the UITableView class which is posted beneath.
end of edit
I have an iOS app and added a UITableView. I’m filling it with custom UICells and in the UITableView I use this method to delete a row and remove the objects from the datasource
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
I also added a modify-button in the UICell, so I also have to access the datasource, but I can’t because it is is the UITableView class and I can’t access it from the UICell class.
What is the best solution for this? Do I have to create a class for my datasource and both classes (UITableView and UICell) access it? If so, how do I do that? Sorry I am new to MVC, please help 🙂
Thanks in advance
You might be filling your table from an array, if this is the case, you can remove the array element at index(selected index) and reload tableview.