문제

나는 문제가 있고, 나는 그것에 대한 간단한 해결책이 있다고 생각하지만, 나는 그것을 추측 할 수 없습니다!

이 코드가 있습니다.

NSManagedObjectContext * context  = [[NSApp delegate] managedObjectContext];
    NSManagedObjectModel   * model    = [[NSApp delegate] managedObjectModel];
    NSDictionary           * entities = [model entitiesByName];
    NSEntityDescription    * entity   = [entities valueForKey:@"Post"];

    NSPredicate * predicate;
    predicate = [NSPredicate predicateWithFormat:@"date < %@", [NSDate date]];

    NSSortDescriptor * sort = [[NSSortDescriptor alloc] initWithKey:@"date" ascending:YES];
    NSArray * sortDescriptors = [NSArray arrayWithObject: sort];

    NSFetchRequest * fetch = [[NSFetchRequest alloc] init];
    [fetch setEntity: entity];
    [fetch setPredicate: predicate];
    [fetch setSortDescriptors: sortDescriptors];

    NSArray * results = [context executeFetchRequest:fetch error:nil];
    [sort release];
    [fetch release];    

지정된 데이터를 배열에서 리턴합니다. 이제 NstableView 에이 데이터를 표시하고 싶습니다.

이 작업을 어떻게할까요?

감사!

도움이 되었습니까?

해결책

nstableview에 바인딩하는 nsarraycontroller의 데이터로 사용할 수 있습니다.

다른 팁

바인딩을 읽어야 할 것 같습니다.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top