【发布时间】:2011-07-24 02:19:13
【问题描述】:
我设置了一个只有两个按钮的 UIActionSheet 弹出窗口,并为其中一个按钮分配了一个动作。该应用程序编译并运行并正常工作,但我收到警告:
warning: class 'MyViewController' does not implement the 'UIActionSheetDelegate' protocol
这是我的操作表代码:
- (IBAction)saveImage {
UIActionSheet *saveMenu = [[UIActionSheet alloc] initWithTitle:@"Save Image to Photo Library"
delegate:self
cancelButtonTitle:@"Dismiss"
destructiveButtonTitle:nil
otherButtonTitles:@"Save Image", nil];
[saveMenu showInView:self.view];
[saveMenu release];
还有我在“保存图片”按钮上签名的操作:
-(void)actionSheet:(UIActionSheet *)actionSheet clickedButtonAtIndex:(NSInteger)buttonIndex {
if (buttonIndex == 0) {
UIImage* imageToSave = [imageView image]; // alternatively, imageView.image
//Save it to the camera roll / saved photo album
UIImageWriteToSavedPhotosAlbum(imageToSave, nil, nil, nil);
}
}
我应该忽略这个构建警告吗?或者我该如何纠正警告?
【问题讨论】:
标签: iphone objective-c cocoa-touch xcode ios4