我有一个小问题-
(顺便说一句,我看过 如何在选择联系人后呈现模式视图控制器? 但它没有帮助我)
基本上我想让用户使用-peoplePickerNavigationController 选择一个联系人。选择后我想展示将使用 personRef 数据的ModalViewController。我可以看到“添加人员”方法被调用,但 iphone 没有显示视图。
更新 -如果我取消 Dismiss dismissModalViewControllerAnimated 和 presentModalViewController 中的动画,它会起作用,但它看起来很丑陋。
这是用户选择联系人后调用的函数 -
- (BOOL)peoplePickerNavigationController:(ABPeoplePickerNavigationController *)peoplePicker shouldContinueAfterSelectingPerson:(ABRecordRef)personRef {
TempREcordId = ABRecordGetRecordID(personRef);
BOOL hasDeleteDate = [GlobalFunctions CheckToSeeIfInHiBye:TempREcordId];
if (hasDeleteDate) {
[GlobalFunctions alert:NSLocalizedString(@"", @"") ];
}else{
[self addCustomValuesAfterSelection];
[self dismissModalViewControllerAnimated:YES];
}
return NO;
}
这是调用的函数,但视图仍然没有呈现 -
- (void)addPerson {
NSLog(@"@2");
AddViewController *addViewController = [[AddViewController alloc] initWithStyle:UITableViewStyleGrouped];
addViewController.delegate = self;
// Create a new managed object context for the new book -- set its persistent store coordinator to the same as that from the fetched results controller's context.
NSManagedObjectContext *addingContext = [[NSManagedObjectContext alloc] init];
self.addingManagedObjectContext = addingContext;
[addingContext release];
[addingManagedObjectContext setPersistentStoreCoordinator:[[fetchedResultsController managedObjectContext] persistentStoreCoordinator]];
addViewController.person = (Person *)[NSEntityDescription insertNewObjectForEntityForName:@"Person" inManagedObjectContext:addingContext];
addViewController.hiByeGroupId = [dataSource hibyeGroupId];
UINavigationController *navController = [[UINavigationController alloc] initWithRootViewController:addViewController];
[self.navigationController presentModalViewController:navController animated:YES];
[addViewController release];
[navController release];
}
非常感谢您。