Objective c 导航控制器:willShowViewController:已设置动画:问题
我的应用程序现在只能与iOS 7和iOS 8兼容,此方法存在问题:Objective c 导航控制器:willShowViewController:已设置动画:问题,objective-c,iphone,ios8,Objective C,Iphone,Ios8,我的应用程序现在只能与iOS 7和iOS 8兼容,此方法存在问题: -(void)navigationController:(UINavigationController *)navigationController willShowViewController:(UIViewController *)viewController animated:(BOOL)animated { ... } 这只在iOS 7中调用,文档中没有说在iOS 8或其他版本中不推荐th
-(void)navigationController:(UINavigationController *)navigationController
willShowViewController:(UIViewController *)viewController
animated:(BOOL)animated
{
...
}
这只在iOS 7中调用,文档中没有说在iOS 8或其他版本中不推荐thas。怎么了,你知道吗
我在Mavericks中使用xcode版本6.0.1(6A317)
我在另一个类中声明委托:
ABPeoplePickerNavigationController *contactos = [[ABPeoplePickerNavigationController alloc] init];
contactos.displayedProperties = [NSArray arrayWithObject:[NSNumber numberWithInt:kABPersonPhoneProperty]];
// Delegate
pickerDelegate = [[PickerDelegate alloc] init];
contactos.peoplePickerDelegate = pickerDelegate;
contactos.topViewController.navigationController.delegate = pickerDelegate;
其中PickerDelegate.h:
#import <Foundation/Foundation.h>
#import <AddressBook/AddressBook.h>
#import <AddressBookUI/AddressBookUI.h>
@interface PickerDelegate : NSObject <UINavigationControllerDelegate, ABPeoplePickerNavigationControllerDelegate, ABPersonViewControllerDelegate, ABNewPersonViewControllerDelegate>
{
...
}
#导入
#进口
#进口
@接口PickerDelegate:NSObject
{
...
}
问题在于您没有设置ABPeoplePickerNavigationController的委托(UINavigationControllerDelegate)。您正在设置它的选择器delegate
(ABPeoplePickerNavigationControllerDelegate),但这不是一回事 代码在哪里?这个对象如何成为导航控制器的代理?你好,matt,我添加了更多代码来澄清我的问题。谢谢…非常感谢我添加了一行:contactos.delegate=pickerDelegate代码>