私は少し問題を抱えています-
(ところで 、連絡先を選択した後、モーダルビューコントローラーを表示するにはどうすればよいですか? が、役に立ちませんでした)
基本的に、ユーザーが--peoplePickerNavigationControllerを使用して連絡先を選択できるようにします。選択後、personRefデータを使用するModalViewControllerを提示します。「人を追加」メソッドが呼び出されているのがわかりますが、iPhoneにビューが表示されません。
更新-DismissdismissModalViewControllerAnimatedと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];
}
どうもありがとうございます。