实现了类似Iphone标准地址View的View

发布于 2024-10-05 12:01:21 字数 237 浏览 5 评论 0原文

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

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

有什么好主意吗?

Is there anyway to implement a view like iphone address view in email compose screen.

I have tried standard UIView which holds a couple of UILabelView, when User touch it, I will change UILabelView to UIButtonView followed by a UITextFieldView,
however, it does not work exactly as Iphone standard address input view and plus I can not detect [back space] when UITextField is empty.

Any good ideas?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

尸血腥色 2024-10-12 12:01:21

怎么样:

1:将 Addressbook.frameworkAddressbookUI.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];
}

How about this:

1: Include the Addressbook.framework and AddressbookUI.framework to your project.

2: in your custom UIViewController, have it inherit from ABPeoplePickerNavigationControllerDelegate to respond to the events.

3: Call setupAddressbookView to initialize the process.

4: Let the user do the rest

-(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];
}
不忘初心 2024-10-12 12:01:21

您可以考虑查看 Three20 库

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

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

You might consider having a look at the Three20 library.

It contains a control that resembles the Email compose view, including the To: field with the tokenised names/addresses.

You could either use it, or look at the source to help you write your own.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文