我的应用程序在ios6.1下正常运行.尝试了ios7模拟器,以下部分不起作用:
EditingCell *cell = (EditingCell*) [[textField superview] superview];
NSIndexPath *indexPath = [self.tableView indexPathForCell:cell];
NSLog(@"the section is %d and row is %d", indexPath.section, indexPath.row);
NSUInteger section = [indexPath section];
NSUInteger row = [indexPath row];
NSString *rowKey = [[keysForRows objectAtIndex: section] objectAtIndex: row];
Run Code Online (Sandbox Code Playgroud)
总是来:
the section is 0 and row is 0
Run Code Online (Sandbox Code Playgroud)
虽然选择了另一个部分/行.有人知道为什么这在ios7下不起作用?
我在tableview单元格中有一个按钮(名为"deleteTemplate"),当按下它时,我应该得到按钮所在单元格的"index.row".任何人都知道如何获取单元格的"index.row" ,当你单击单元格中的按钮?
我目前的按钮代码:
UITableViewCell *clickedCell = (UITableViewCell *)[[sender superview] superview];
NSIndexPath *clickedButtonIndexPath = [self.tableView indexPathForCell:clickedCell];
NSDictionary *dic = [tableData objectAtIndex:clickedButtonIndexPath.row];
Run Code Online (Sandbox Code Playgroud)
但是clickedButtonIndexPath = NULL?:(
这适用于iOS 6.
谢谢!!!