0

RestKit を使用して API からのデータを操作しています。

ビジネスのリストを取得したいのですが、正しく返されています。それでも、そのリストを取得したら結果UITableView.

応答例:

"venue": [{
    "name": "X Business", {

API 応答の前にこれらの結果を削除する方法はありません。API 応答を取得したら結果を表示する前にこれを行う方法はありますUITableViewか?

編集:

ビューコントローラー

@property (strong, nonatomic) NSArray *springs;
@property (strong, nonatomic) NSMutableArray *leafs;


    - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
    {
        static NSString *CellIdentifier = @"standardCell";
        UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];

        Spring *spring = [springs objectAtIndex:indexPath.section];  // 13 objects
        Leaf *leaf = [spring.leafs objectAtIndex:indexPath.row];  // 30 objects

        cell.textLabel.text = leaf.shortName;
        return cell;
    }

EDIT 2: Response.m はモデルです

@implementation Response

+ (RKObjectMapping *)mapping {
    RKObjectMapping *objectMapping = [RKObjectMapping mappingForClass:[self class] usingBlock:^(RKObjectMapping *mapping) {
        [mapping mapKeyPathsToAttributes:
         @"premium", @"premium",
         nil];
    }];

    return objectMapping;
}

@end
4

2 に答える 2

1

API から取得した配列を NSPredicate でフィルタリングするだけでよい場合があります。たとえば、配列内の各オブジェクト (例: Spring など) に businessName プロパティがある場合です。

NSPredicate *predicate = [NSPredicate predicateWithFormat:@"businessName = %@", @"McDonalds"];
NSArray *filteredArray = [self.springs filteredArrayUsingPredicate:predicate];
于 2013-05-23T03:10:24.153 に答える