1
次のフェッチがあります。私は、述語が真であるSession
オブジェクトをフェッチしたい。NSFetchRequestのヘルプが必要
私はこの権利をしているかどうか誰にでも教えてください。そして、それが認識されていないので、どのように私はindexPath
を初期化/定義できますか?
NSDate * searchDate = [formatter dateFromString:dateString];
NSFetchRequest *request = [[NSFetchRequest alloc]init];
NSEntityDescription *entity = [NSEntityDescription entityForName:@"Session" inManagedObjectContext:self.managedObjectContext];
[request setEntity:entity];
NSPredicate * predicate1 = [NSPredicate predicateWithFormat:@" timeStamp == %@ ", searchDate];
[request setPredicate: predicate1];
[request setFetchBatchSize:20];
NSSortDescriptor *sortDescriptor = [[NSSortDescriptor alloc] initWithKey:@"timeStamp" ascending:NO];
NSArray *sortDescriptors = [[NSArray alloc] initWithObjects:sortDescriptor, nil];
[request setSortDescriptors:sortDescriptors];
NSError *error = nil;
NSArray *array = [managedObjectContext executeFetchRequest:request error:&error];
SessionViewController *sessionViewController = [[SessionViewController alloc] initWithNibName:@"SessionViewController" bundle:nil];
self.selectedSession = (Session *)[array objectAtIndexPath:indexPath];
sessionViewController.selectedSession = self.selectedSession;
[self.navigationController pushViewController:sessionViewController animated:YES];
[sessionViewController release];
[sortDescriptor release];
[request release];
[sortDescriptors release];
おかげで、ジョーのすべてを掲示場合、複数のオブジェクト上のあなたの行方不明のリリース、私はacutallyこのコードwithaカレンダーを使用していますメソッドタイトルは ' - (void)calendarMonthView:(TKCalendarMonthView *)monthView didSelectDate:(NSDate *)d'です。私はこのメソッドを適切に使う方法があまりよく分かりません。 – Jon
複数のセッションを1つの日付にすることは可能ですか?もしそうなら、複数のセッションをどのように表示していますか? – Joe
いいえ、セッションが作成されると、1つの日付に対して1を超えることはできません。 2つのセッションオブジェクトの日付は同じではありません。 (日) – Jon