我们可以在ios编辑器/ CNContactViewController中显示数据,而只显示空白文本字段吗?
例如,当我打开CNContactViewController时,我希望在用户输入任何内容之前填充名称
答案 0 :(得分:2)
是的,有可能。使用CNContactViewController的viewControllerForNewContact:方法,您可以传递CNContact对象。
因此,为了在视图中显示名称,请创建一个带有名称的联系人对象并传递给viewControllerForNewContact:
CNMutableContact *pNewContact = [[CNMutableContact alloc] init];
pNewContact.givenName = @"My Name";
CNContactViewController *pNewContactVC = [CNContactViewController viewControllerForNewContact:pNewContact];
UINavigationController *pNavController = [[UINavigationController alloc] initWithRootViewController:pNewContactVC];
[self presentViewController:pNavController animated:YES
completion:nil];