2012-04-25 16 views
3

私はアドレス帳アプリを開発中です。ユーザーが連絡先リストからユーザーを選択すると、ABPersonViewControllerの編集ボタンの代わりに、ABPersonViewControllerを使用してEDITモードでそのレコードを直接開きたいとします。どうすればこれを達成できますか?直接編集モードでABPersonViewControllerを直接開きます。

ABPersonViewController *ab = [[ABPersonViewController alloc] init]; 
ab.allowsEditing = YES; 
// customize as you see fit 
[self.navigationController pushViewController:ab animated:YES]; 
[ab setEditing:YES animated:NO]; 

私はポップオーバーコントローラ内からiPadでこれを試み、それが正常に動作します:ビューが表示された後のおかげ

+0

このプロジェクトを見ていますか?https://developer.apple.com/library/ios/#samplecode/QuickContacts/Listings/Classes_QuickContactsViewController_m.html#//apple_ref/doc/uid/DTS40009475-Classes_QuickContactsViewController_m-DontLinkElementID_6 – Jatin

答えて

2

ちょうどsetEditingを呼び出します。

+0

情報ありがとうございました – iOSAppDev

+3

これは私にとっては役に立ちません。私はまだ右上の編集ボタンで人の詳細ウィンドウを取得します – Delcasda

+0

それはもはやiOS7で動作しないかもしれません。 –

-2

私は、このようにすることで同じことを達成:

ABRecordID personId = (ABRecordID)contact_ID;// if you want to edit a particular record and you're maintaining contact ID somewhere in your project. 
    ABPersonViewController *contactVC = [[ABPersonViewController alloc] init]; 
    contactVC.personViewDelegate = self;// set your ViewController as delegate 
    contactVC.allowsEditing = YES; //set NO if you don't wanna allow editing 
    contactVC.displayedPerson = ABAddressBookGetPersonWithRecordID(addressBook, personId); 
    [self.navigationController presentViewController:contactVC animated:YES completion:nil]; 
1

を実際にAB PersonViewControllerが編集モードで正確ABPersonViewControllerように見えます。

+0

素晴らしいソリューション!そして、「新しい連絡先」ではなく、ABNewPersonViewController.Titleを好みのものに変更するだけです。 – TreeAndLeaf

関連する問題