每次索引的索引为0:
- (UIView *)swipeView:(SwipeView *)swipeView viewForItemAtIndex:(NSInteger)index reusingView:(UIView *)view
{
view = [[MTResultCard alloc] initWithFrame:_swipeView.frame];
NSDictionary *resultsDictionary = [[MTDataLayer sharedDataLayer].results objectForKey:@"mykey"];
NSString *key = [[[[MTDataLayer sharedDataLayer].results objectForKey:@"mykey"] allKeysSorted] objectAtIndex:index];
((MTResultCard *)view).item = [[[MTDataLayer sharedDataLayer].results objectForKey:@"mykey"] objectForKey:key];
return view;
}
-(NSArray *)allKeysSorted{
return [[self allKeys]sortedArrayUsingComparator:^NSComparisonResult(NSString* obj1, NSString* obj2) {
return [obj1 compare:obj2];
}];
}
可以查看完整代码here
每次我索引= 0时会出现什么原因?