0

我将如何挑选 NSMutableArray 的某些部分?来自服务器的一个部署阵列是 2012-09-01 09:00:00 America/Los_Angeles 我正试图赶上时间。我在想把它变成一个字符串,然后得到它,然后回到 NSMutablearray 来填充到 tableview 单元格。我还在看文档

我正在考虑的选项:-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 回答