【发布时间】:2013-09-15 14:10:13
【问题描述】:
我的应用在 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];
总会来的:
the section is 0 and row is 0
虽然选择了另一个部分/行。 有人知道为什么这在 ios7 下不起作用吗?
【问题讨论】:
-
您是否验证过 textfield.superview.superview 是KindOfClass EditingCell?单元格的视图层次结构可能已更改。
-
[[textField superview] superview]是一种非常糟糕的引用方式。 -
我得到了这个应用程序......并希望让它在 iOS 7 下运行。
-
如何验证编辑单元格是否是kindofclass? (我对 ios 开发非常陌生..)
-
要找出你的单元格是什么类,试试
NSLog(@"Class of Cell: %@", NSStringFromClass(cell.class));你也可能想查看 UITableView-Method ìndexPathOfSelectedCell`。希望对您有所帮助。
标签: ios objective-c uitableview ios7