gpt4 book ai didi

iphone - 在 Unknown Person ViewController 中添加导航栏

转载 作者:行者123 更新时间:2023-11-28 23:16:41 24 4
gpt4 key购买 nike

ABUnknownPersonViewController *unknownPersonViewController = [[ABUnknownPersonViewController alloc] init];

unknownPersonViewController.view.frame = CGRectMake(0, 20, 320, 400);

//unknownPersonViewController.displayedPerson = (ABRecordRef)[self buildContactDetails];
unknownPersonViewController.allowsAddingToAddressBook = YES;

UIButton *cancelBtn = [UIButton buttonWithType:UIButtonTypeRoundedRect];
cancelBtn.frame = CGRectMake(262, 6, 54,30);
[unknownPersonViewController.view addSubview:cancelBtn];

[self presentModalViewController:unknownPersonViewController animated:YES];

[unknownPersonViewController release];

我正在使用 UIViewcontroller 并且在这段代码中我希望像导航栏这样的栏将显示在上部这个 Controller 的一侧,所以我想把取消按钮放在那个栏上。有什么帮助吗?

最佳答案

你应该做的是将你的 ABUnknownPersonViewController 嵌入 UINavigationController

UINavigationController *newNavigationController = [[UINavigationController alloc] initWithRootViewController:unknownPersonViewController];

[self presentModalViewController:newNavigationController animated:YES];
[view release];

[newNavigationController release];

这样您甚至不必自己添加按钮,ABUnknownPersonViewController 会为您处理。

更多信息请查看Address Book Programming

关于iphone - 在 Unknown Person ViewController 中添加导航栏,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6072582/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com