の 2 つのタブの最初に設定された距離プロパティを使用して、Arrayのオブジェクトを作成することができました。私の2番目のタブでは、次のようになります:MyLocationtabBarControllerviewDidLoad
[self setAnnotationsToSort:myDelegate.annotationsToSort];
この行の直後に、このメソッドを呼び出します。
-(void)sort{
NSSortDescriptor *sortDescriptor;
sortDescriptor = [[[NSSortDescriptor alloc] initWithKey:@"distance" ascending:YES] autorelease];
NSArray *sortDescriptors = [NSArray arrayWithObject:sortDescriptor];
NSArray *sortedArray;
sortedArray = [self.annotationsToSort sortedArrayUsingDescriptors:sortDescriptors];
[self.tableView reloadData];
}
私のをソートする必要がありますArray。ただし、tableView現在、ソートされていないバージョンArrayのself.annotationsToSort. tableViewをリロードして強制的に新しいを使用するにはどうすればよいsortedArrayですか?