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,并且在此代码中,我希望像导航栏这样的栏会显示在上方
该控制器的侧面,所以我想在该bar.bar上放置取消按钮,有什么帮助吗?
最佳答案
您应该做的是将ABUnknownPersonViewController
嵌入UINavigationController中
UINavigationController *newNavigationController = [[UINavigationController alloc] initWithRootViewController:unknownPersonViewController];
[self presentModalViewController:newNavigationController animated:YES];
[view release];
[newNavigationController release];
这样,您甚至不必自己添加按钮,
ABUnknownPersonViewController
会为您处理。有关更多信息,请检查Address Book Programming
关于iphone - 在ABUnknownPersonViewController中添加导航栏,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/6072582/