在NavBar上推送视图时出错

时间:2011-06-28 00:26:19

标签: iphone objective-c

当我推送视图时,我在控制台中收到以下错误:

nested push animation can result in corrupted navigation bar
Finishing up a navigation transition in an unexpected state. Navigation Bar subview tree might get corrupted.

任何想法如何解决这个问题?

这是推动新视角的方法:

- (void)calendarMonthView:(TKCalendarMonthView *)monthView didSelectDate:(NSDate *)d {
    NSDateFormatter* formatter = [[[NSDateFormatter alloc] init] autorelease];
    [formatter setDateFormat:@"yyyy-MM-dd HH:mm:ss Z"];
    [formatter setTimeZone:[NSTimeZone timeZoneWithAbbreviation:@"GMT"]];
    NSString * dateString = [formatter stringFromDate:d];

    if ( [data containsObject:dateString] ) 
    {
        NSDate * searchDate = [formatter dateFromString:dateString];
        NSCalendar * calendar1 = [[[NSCalendar alloc] initWithCalendarIdentifier:NSGregorianCalendar] autorelease];
        NSDateComponents * dateComponents = [[[NSDateComponents alloc] init] autorelease];
        [dateComponents setDay:1];

        NSDate * searchDateEnd = [calendar1 dateByAddingComponents:dateComponents toDate:searchDate options:0];

        NSFetchRequest *request = [[NSFetchRequest alloc]init];
        NSEntityDescription *entity = [NSEntityDescription entityForName:@"Session" inManagedObjectContext:self.managedObjectContext];
        [request setEntity:entity];
        NSPredicate * predicate1 = [NSPredicate predicateWithFormat:@"timeStamp >= %@ AND timeStamp < %@", searchDate, searchDateEnd];
        [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];
        NSLog(@"xxx array: %@", array);
        SessionViewController *sessionViewController = [[SessionViewController alloc] initWithNibName:@"SessionViewController" bundle:nil];
        self.selectedSession = (Session *)[array objectAtIndex:0];
        sessionViewController.selectedSession = self.selectedSession;

        NSDateFormatter *dateFormatter = [[NSDateFormatter alloc] init]; 
        [dateFormatter setDateFormat:@"MMM d, y"]; 
        NSString *dateString = [dateFormatter stringFromDate:selectedSession.timeStamp]; 
        sessionViewController.title = dateString;
        sessionViewController.hidesBottomBarWhenPushed = YES;
        [self.navigationController pushViewController:sessionViewController animated:YES];

        [sessionViewController release];
        [dateFormatter release];
        [sortDescriptor release];
        [request release];
        [sortDescriptors release];
    }
}

0 个答案:

没有答案