В UITableView, я могу видеть их в файле .h:в indexPath UICollectionView в
@interface NSIndexPath (UITableView)
+ (NSIndexPath *)indexPathForRow:(NSInteger)row inSection:(NSInteger)section;
@property(nonatomic,readonly) NSInteger section;
@property(nonatomic,readonly) NSInteger row;
@end
В UICollectionView, я могу найти эту категорию:
@interface NSIndexPath (UICollectionViewAdditions)
+ (NSIndexPath *)indexPathForItem:(NSInteger)item inSection:(NSInteger)section NS_AVAILABLE_IOS(6_0);
@property (nonatomic, readonly) NSInteger item NS_AVAILABLE_IOS(6_0);
@end
Но, если Внутри CollectionView-х класс делегата, я ссылаюсь на свойство «section» в indexPath для коллекцииView, Xcode не дает никаких предупреждений, почему?
-(NSInteger)collectionView:(UICollectionView*)cv numberOfItemsInSection:(NSInteger)section {
if (cv == self.collectionView) {
if (cv.collectionViewLayout == self.layout2) {
return [self.searches count];
} else {
NSString *searchTerm = self.searches[section];
return [self.searchResults[searchTerm] count];
}
} else if (cv == self.currentPinchCollectionView) {
//commend for below == @property (nonatomic, strong) NSIndexPath *currentPinchedItem;
NSString *searchTerm = self.searches[self.currentPinchedItem.section];// this "section" is NOT for tableView, why NO warning/error from Xcode?
return [self.searchResults[searchTerm] count];
}
return 0;
}
Thanks Kujey! холодно вы показываете мне какое-либо подтверждение (в документации или файле .h), что «раздел является доступным свойством повсюду в рамках»? –