TableView セルの並べ替えに取り組んでいますが、何らかの理由で機能していません。私はまったく同じコードとまったく同じ PLIST の以前のリビジョンを持っていましたが、数か月間は機能していたと断言できます。現在、ソートを拒否しています。
numberOfRowsInSection メソッド内のソート コード:
NSString *date = [self.months objectAtIndex:sectionNumber];
NSDictionary *monthData = [self.sportDictionary objectForKey:date];
NSSortDescriptor *sortDescriptor2 = [[NSSortDescriptor alloc] initWithKey: nil ascending: YES];
NSArray *days = (NSArray *)[[monthData allKeys]sortedArrayUsingDescriptors:[NSArray arrayWithObject:sortDescriptor2]];
for(int x = 0; x < [days count]; x++)
{
NSLog(@"Day: %@", [days objectAtIndex:x]);
}
NSLog の出力を見ると、正しくありません。15、22、29、3、8 を取得する
並べ替えている PList の部分は次のとおりです。
<dict>
<key>1 September 2012</key>
<dict>
<key>3</key>
<array>
<string>Georgia Tech (Orange Effect)</string>
<string>8:00 PM </string>
<string>Home</string>
</array>
<key>8</key>
<array>
<string>Austin Peay (White Effect)</string>
<string>1:30 PM</string>
<string>Home</string>
</array>
<key>15</key>
<array>
<string>Pittsburgh (White Effect)</string>
<string>12:00 PM</string>
<string>Away</string>
</array>
<key>22</key>
<array>
<string>Bowling Green</string>
<string>TBA</string>
<string>Home</string>
</array>
<key>29</key>
<array>
<string>Cincinnati</string>
<string>TBA</string>
<string>Away</string>
</array>
</dict>
ありがとう、助けてくれて本当にありがとう!