使用不是“自我”的ActionSheetDelegate时出错

时间:2012-11-02 00:21:05

标签: objective-c ios uiactionsheet

我想创建一个实现UIActionSheetDelegate协议的类,这样我就可以将所有相机行为封装在一个类中,并使用ActionSheet从另一个ViewController调用它。当我实例化一个ActionSheet并指定一个外部类作为委托时,我得到一个错误,当我使用self作为委托时,它工作正常。我无法在网上找到任何UIActionSheetDelegate的例子,而不是" self"。有没有人这样做过?

UIStoryboard*  sb = [UIStoryboard storyboardWithName:@"MainStoryboard_iPhone"
                                              bundle:nil];
CameraMenuViewController *cameraMenuViewController = [sb     instantiateViewControllerWithIdentifier:@"cameraView"];

UIActionSheet *cameraMenu = [[UIActionSheet alloc] initWithTitle:@"Take or Choose a Snap!" delegate:cameraMenuViewController cancelButtonTitle:@"Cancel Button" destructiveButtonTitle:nil otherButtonTitles:@"Camera", @"Photo Library", nil];
cameraMenu.actionSheetStyle = UIActionSheetStyleBlackTranslucent;
[cameraMenu showInView:self.view]; 

0 个答案:

没有答案