【发布时间】:2011-01-13 19:35:55
【问题描述】:
谁能证实我对这行代码的怀疑。
NSUInteger newPath[] = {[indexPath section],0};
我很确定它是一个 NSUInteger 的 C 数组。 我是对的吗? 你甚至可以制作 Objective C 对象的 C 数组吗?
这是上下文中的代码:
-(UITableViewCellEditingStyle)tableView:(UITableView *) tableViewEditingStyleForRowAtIndexPath:(NSIndexPath*)indexPath{
if ([self isToManyRelationshipSection:[indexPath section]]) {
NSUInteger newPath[] = {[indexPath section],0};
NSIndexPath *row0IndexPath = [NSIndexPath indexPathWithIndexes:newPath length:2];
NSString *rowKey = [rowKeys nestedObjectAtIndexPath:row0IndexPath];
NSString *rowLabel = [rowLabels nestedObjectAtIndexPath:row0IndexPath];
NSMutableSet *rowSet = [managedObject mutableSetValueForKey:rowKey];//!!!: to-many?
NSArray *rowArray = [NSArray arrayByOrderingSet:rowSet byKey:rowLabel ascending:YES];
if ([indexPath row] >= [rowArray count]) {
return UITableViewCellEditingStyleInsert;
}
return UITableViewCellEditingStyleDelete;
}
return UITableViewCellEditingStyleNone;
【问题讨论】:
-
NSUInteger 不是一个对象,它是一个 c 类型,在这里定义:developer.apple.com/library/ios/documentation/Cocoa/Reference/…
-
很好,我没有意识到。所以它是一个动态的基本类型。 “在构建 32 位应用程序时,NSUInteger 是 32 位无符号整数。64 位应用程序将 NSUInteger 视为 64 位无符号整数”
标签: objective-c uitableview ios