在为ABPeoplePickerNavigationController设置委托时收到警告

时间:2011-02-14 10:49:27

标签: delegates uinavigationbar picker abpeoplepickerview

我正在尝试使用以下代码段构建应用

我的界面定义是

@interface CreateMessageViewController : UIViewController

和我点击Button按钮的方法是

-(IBAction) handleEvents:(id) sender
 {
    if ((UIButton *) sender == openContact)
    {
       ABPeoplePickerNavigationController *picker = [[ABPeoplePickerNavigationController alloc] init];
       picker.peoplePickerDelegate = self;
       [self presentModalViewController:picker animated:YES];
       [picker release];
    }}

现在我收到picker.peoplePickerDelegate = self;

的警告
  

警告:类'CreateMessageViewController'未实现'ABPeoplePickerNavigationControllerDelegate'协议

我无法删除警告。请在这方面帮助我

任何形式的帮助都将受到高度赞赏

提前致谢!!

1 个答案:

答案 0 :(得分:1)

需要为

peoplePickerDelegate指定一些支持控制器类不支持的ABPeoplePickerNavigationControllerDelegate协议的东西(如果对你来说不明显,则自己是你控制器的一个实例)。试试

@interface CreateMessageViewController : UIViewController  <ABPeoplePickerNavigationControllerDelegate> {}

并实施相关信号