首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >ABPersonViewController ...无后退按钮

ABPersonViewController ...无后退按钮
EN

Stack Overflow用户
提问于 2010-08-16 05:20:48
回答 1查看 1.3K关注 0票数 1

我有一个简单的项目基于“基于导航的应用程序”项目类型。RootViewController有一个列表行,其中包含一些联系人的姓名,还有一个按钮,可以使用ABPersonViewController将它们带到该联系人的详细信息页面。

我让所有的钩子都工作了,并且我通过在导航堆栈上推送它来显示正确的ABPersonViewController……但是它没有后退按钮!应用程序被卡住了,因为无法返回到我的应用程序。如何启用后退按钮?会很感谢你的帮助。

相关代码如下:

代码语言:javascript
复制
- (void) nameButtonClicked: (id) sender
{
    UIButton *button = (UIButton *) sender;
    NSLog(@"name button clicked... record_id = %i", button.tag);
    ABRecordRef contact_data = ABAddressBookGetPersonWithRecordID(address_book, button.tag);

    ABPersonViewController *ab = [[ABPersonViewController alloc] init];
    [ab setPersonViewDelegate:self];
    [ab setDisplayedPerson:contact_data];
    ab.allowsEditing = YES;
    [self.navigationController pushViewController:ab animated:YES];
    [ab release];
}
EN

回答 1

Stack Overflow用户

发布于 2011-06-19 18:57:47

如果你找不到系统的后退按钮,你可以自己创建一个。

代码语言:javascript
复制
- (void) nameButtonClicked: (id) sender
{
UIButton *button = (UIButton *) sender;
NSLog(@"name button clicked... record_id = %i", button.tag);
ABRecordRef contact_data = ABAddressBookGetPersonWithRecordID(address_book, button.tag);

ABPersonViewController *ab = [[ABPersonViewController alloc] init];
ab.navigationItem.backBarButtonItem = [[UIBarButtonItem alloc] initWithTitle:NSLocalizedString(@"Back",nil) style:UIBarButtonItemStyleDone target:self action:@selector(ReturnFromPersonView)];
[ab setPersonViewDelegate:self];
[ab setDisplayedPerson:contact_data];
ab.allowsEditing = YES;
[self.navigationController pushViewController:ab animated:YES];
[ab release];
}

- (void)ReturnFromPersonView{
[self.navigationController popViewControllerAnimated:YES];
}

好运=]

顺便说一句,如果你不喜欢“完成”按钮样式,你可以随时使用一个自定义的按钮样式的后退按钮箭头的外观。

票数 2
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/3489317

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档