我有一个问题。ABUnknownPersonViewController 嵌入在顶部视图的导航控制器中,但是,我没有在我的应用程序中使用导航栏。推送到 ABUnknownPersonView 时,我没有看到导航栏或后退按钮。我的解决方案是这样的:
ABUnknownPersonViewController *unknownPersonViewController = [[ABUnknownPersonViewController alloc] init];
unknownPersonViewController.displayedPerson = (ABRecordRef)[self buildContactDetails];
unknownPersonViewController.allowsAddingToAddressBook = YES;
unknownPersonViewController.unknownPersonViewDelegate = self;
UINavigationBar *navBar = [[UINavigationBar alloc] initWithFrame:CGRectMake(0, 0, [UIScreen mainScreen].bounds.size.width, 41)]; navBar.delegate = self;
UINavigationItem *backItem = [[UINavigationItem alloc] initWithTitle:@"Back"];
[navBar pushNavigationItem:backItem animated:NO];
UINavigationItem *topItem = [[UINavigationItem alloc] initWithTitle:@"Your Title"];
[navBar pushNavigationItem:topItem animated:NO];
topItem.leftBarButtonItem = nil;
[unknownPersonViewController.view addSubview:navBar];
[self.navigationController pushViewController:unknownPersonViewController animated:YES];
所以这会添加一个导航栏,但后退按钮除了将标题更改为“后退”之外没有任何作用......非常有帮助,哈哈。此外,顶部的导航栏没有边界,所以我遇到了一些困难......下面的图片