我已經設置了一個UIActionSheet彈出只有兩個按鈕,併爲其中的一個分配了一個動作。該應用程序編譯和運行和正常工作,但我得到警告:UIActionSheetDelegate警告視圖控制器
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);
}
}
我應該忽略此構建警告嗎?或者我該如何糾正警告?