0

无论如何要在电子邮件撰写屏幕中实现类似 iphone 地址视图的视图。

我已经尝试过包含几个 UILabelView 的标准 UIView,当用户触摸它时,我会将 UILabelView 更改为 UIButtonView,然后是 UITextFieldView,但是,它不能完全像 Iphone 标准地址输入视图那样工作,而且我无法检测到 [back space ] 当 UITextField 为空时。

有什么好主意吗?

4

2 回答 2

0

您可能会考虑查看Three20 库

它包含一个类似于电子邮件撰写视图的控件,包括To:带有标记名称/地址的字段。

您可以使用它,也可以查看源代码来帮助您编写自己的代码。

于 2010-12-03T17:28:15.427 回答
0

这个怎么样:

1:将Addressbook.frameworkand包含AddressbookUI.framework到您的项目中。

2:在您的自定义UIViewController中,让它继承ABPeoplePickerNavigationControllerDelegate以响应事件。

3:调用setupAddressbookView初始化流程。

4:让用户做剩下的事

-(void) setupAddressbookView 
{
     ABPeoplePickerNavigationController *controller = [[ABPeoplePickerNavigationController alloc] init];
     controller.peoplePickerDelegate = self;
     controller.modalTransitionStyle = UIModalTransitionStyleCrossDissolve;
     [self presentModalViewController:controller animated:YES];
     [controller release];
}

-(BOOL) peoplePickerNavigationController:(ABPeoplePickerNavigationController *)peoplePicker shouldContinueAfterSelectingPerson:(ABRecordRef)person
{
    [self dismissModalViewControllerAnimated:YES];
    // show your mail view here
    return NO;
}

-(void) peoplePickerNavigationControllerDidCancel:(ABPeoplePickerNavigationController *)peoplePicker
{
    [self dismissModalViewControllerAnimated:YES];
}
于 2010-12-03T16:02:12.923 回答