2017-01-29 6 views
0

WhatsApp와 같은 연락처 편집 화면을 한 번에 표시하는 작업이 있는데, 나는 그에게 다음과 같은 방법을 보여줍니다.CNContactViewController setEditing before to appear

@objc private func presentContactEditController() { 
     guard var contact = contactModel.contact else { return } 
     if !contact.areKeysAvailable([CNContactViewController.descriptorForRequiredKeys()]) { 
      do { 
       let contactStore = CNContactStore() 
       contact = try contactStore.unifiedContact(withIdentifier: contact.identifier, keysToFetch: [CNContactViewController.descriptorForRequiredKeys()]) 
      } catch { 
       debugPrint("presentContactEditController error", error.localizedDescription) 
      } 
     } 
     let cnContactViewController = CNContactViewController(for: contact) 
     cnContactViewController.delegate = self 
     cnContactViewController.setEditing(true, animated: false) 

     let contactNaviController = UINavigationController(rootViewController: cnContactViewController) 
     present(contactNaviController, animated: true, completion: nil) 
    } 

하지만이 연락처에 대한 정보가있는 화면이 있습니다. 그래서 CNContactViewController, 다른 방법 ViewController 라이프 사이클의 상속을 통해 그것을하려하지만, 그것은 viewDidAppear 메서드에서만 작동하지만 사용자에게 표시됩니다. 이 문제를 어떻게 해결할 수 있습니까? 고맙습니다.

답변

0

WhatsApp이 이러한 목적을 위해 사용자 지정 화면을 만드는 것으로 결론을 냈습니다. Telegram에서 수정 된 디자인으로 만 동일한 화면을 보았습니다.

1

단지 (대한 : 접점) cnContactViewController = CNContactViewController 수 있도록 변경

에하자 CVC = CNContactViewController : 당신

을 위해 작동 할

(forNewContact 접촉)