在滑动控制器取消时单击 AddPhoto
Observe 后,newcontact 和 done 消失。
var contact = new CNMutableContact
{
// Given and family names.
FamilyName = participant.LastName,
GivenName = participant.FirstName,
//Note = participant.Note,
OrganizationName = participant.Company,
};
if (!string.IsNullOrEmpty(participant.IconUrl))
{
NSUrl url = new NSUrl(participant.IconUrl);
UIImage image = UIImage.LoadFromData(NSData.FromUrl(url));
NSData data = image.AsPNG();
contact.ImageData = data;
}
var contactViewController = CNContactViewController.FromNewContact(contact);
contactViewController.Delegate = this;
在本节中,我们使用现有数据添加联系人。然后将contactview 控制器添加为当前视图控制器。
var nc = new UINavigationController(contactViewController);
this.PresentViewController(nc, true, () => {
});