我有一個小問題 -在peoplePickerNavigationController中選擇了聯繫人後呈現viewController?
(BTW我已經看過上 How can I present a modal view controller after selecting a contact? 但它沒有幫我)
基本上,我想要讓用戶選擇使用的聯繫人 - peoplePickerNavigationController。選擇後,我想呈現將使用personRef數據的ModalViewController。 我可以看到「添加人員」方法被調用,但iphone不顯示視圖。
更新 -它的作品,如果我取消動畫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];
}
非常感謝你許多。
謝謝,我會盡力的。 – shannoga 2011-02-02 12:26:16
而且?它有用嗎? – Krumelur 2011-02-02 22:19:54