2012-10-03 56 views
0

接收“UIAlertView无可见@interface声明选择器消息:delegate:otherButtonTitles'”。我试图在用户选择图像后设置一个2按钮提示对话框。我有.h文件UIAlertDelegate。下面是警告对话框中的影像撷取代码:使用警报对话框出错

- (void)imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary *)info { 
    [[UIApplication sharedApplication]setStatusBarHidden:YES]; 
    [self dismissModalViewControllerAnimated:YES]; 
    UIImage *originalImage = [info objectForKey:UIImagePickerControllerOriginalImage]; 
    NSData *imageData = UIImagePNGRepresentation(originalImage); 
    NSString* imageName = @"yourPhoto.png"; 
    NSString* paths = [NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES)objectAtIndex:0]; 
    NSString* fullPathToFile = [paths stringByAppendingPathComponent:imageName]; 
    [imageData writeToFile:fullPathToFile atomically:NO]; 

UIAlertView *dir; 
dir = [[[UIAlertView alloc] 
     message:@"Choose the direction." 
     delegate:self 
     otherButtonTitles:@"Left",@"Right",nil]; 
[dir show]; 
} 

- (void)imagePickerControllerDidCancel:(UIImagePickerController *)picker { 
    [[UIApplication sharedApplication] setStatusBarHidden:YES]; 
    [self dismissModalViewControllerAnimated:YES]; 
} 

就行“DIR = [[UIAlertView中页头]错误显示任何人都可以帮我,为什么我得到这个错误,如何修复它呢?谢谢

回答

0

我明白了,看起来你必须在alert对话框中有@消息“string”和CancelButtonTitle:@“string”