0

NSMutableArrayの特定の部分をどのように選択しますか?サーバーからの1つのフィールド配列は2012-09-0109:00:00America/Los_Angelesです。私はちょうど時間を取得しようとしています。私はそれを文字列に変換してから取得し、NSMutablearrayに戻してテーブルビューセルに入力することを考えていました。私はまだドキュメントを見ています

私が考えているオプション:-subarrayWithRange:componentsSeparatedByString:

更新:これが私が予定のフィールドを取得するために今していることです

NSDictionary *json = [NSJSONSerialization JSONObjectWithData:responseData options:NSJSONReadingMutableContainers error:&error];

    NSDictionary* myslots =[json objectForKey:@"slots"];
    self.timesArray = [[NSMutableArray alloc] init];
    NSLog(@"allslots: %@", myslots);

    for (NSString *slotKey in myslots.allKeys) {
    NSDictionary *slot = [myslots valueForKey:slotKey];

        for (myDays in slot){

        if ([[self.myDays objectForKey:@"isReservable"] isEqualToNumber:[NSNumber numberWithInt:1]])

           [self.timesArray addObject:[self.myDays objectForKey:@"begin"]];

        //NSLog(@"This is the times count: %@", timesArray.count);

    }





    }
     NSLog(@"These are the times avail: %@", self.timesArray); 
     [self.tableView reloadData];
}

私が最終的に欲しいのは、ちょうど時間の配列です。はっきりしない場合は申し訳ありません。私は。。をしようとしています。より鮮明な絵を描くために私が提供できる情報を教えてください

4

1 に答える 1

1

最初に文字列として保存します

NSString *someString = [myArray objectAtIndex:index];

NSMakeRange のようなものを使用して、そのビットだけを取得します

[someString substringWithRange:NSMakeRange(11,18)];
于 2012-09-02T17:29:29.053 に答える