无论如何要在电子邮件撰写屏幕中实现类似 iphone 地址视图的视图。
我已经尝试过包含几个 UILabelView 的标准 UIView,当用户触摸它时,我会将 UILabelView 更改为 UIButtonView,然后是 UITextFieldView,但是,它不能完全像 Iphone 标准地址输入视图那样工作,而且我无法检测到 [back space ] 当 UITextField 为空时。
有什么好主意吗?
无论如何要在电子邮件撰写屏幕中实现类似 iphone 地址视图的视图。
我已经尝试过包含几个 UILabelView 的标准 UIView,当用户触摸它时,我会将 UILabelView 更改为 UIButtonView,然后是 UITextFieldView,但是,它不能完全像 Iphone 标准地址输入视图那样工作,而且我无法检测到 [back space ] 当 UITextField 为空时。
有什么好主意吗?
这个怎么样:
1:将Addressbook.framework
and包含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];
}