0

我正在UIPickerview根据我的项目要求开发一个应用程序。我想从服务器下载 pdf。我正在开发代码,但是发生了错误。请帮助我的人。我是编程新手。

pdfviewcontroller.m-

#define kStringURLViewControllerPDF @"https://developer.apple.com/library/ios/DOCUMENTATION/UIKit/Reference/UIViewController_Class/UIViewController_Class.pdf"
#define kStringURLQLPreviewControllerPDF @"https://developer.apple.com/library/ios/DOCUMENTATION/NetworkingInternet/Reference/QLPreviewController_Class/QLPreviewController_Class.pdf"

- (NSInteger) numberOfComponentsInPickerView:(UIPickerView *)pickerView {
    return 1;
}

-(NSInteger)pickerView:(UIPickerView *)pickerView numberOfRowsInComponent:(NSInteger)component {
    return [listArray count];
}

-(NSString *)pickerView:(UIPickerView *)pickerView titleForRow:(NSInteger)row forComponent:(NSInteger)component {
    return [listArray objectAtIndex:row];
}

-(void)pickerView:(UIPickerView *)pickerView didSelectRow:(NSInteger)row inComponent:(NSInteger)component {

    NSLog(@"Selected Color: %@. Index of selected color: %i", [listArray objectAtIndex:row], row);

    switch (component.row) {

        case 0:
            url = [NSURL URLWithString:kStringURLViewControllerPDF];
            break;

        case 1:
            url = [NSURL URLWithString:kStringURLQLPreviewControllerPDF];
            break;

        case 2:
            url = [NSURL URLWithString:kStringURLUIDocumentInteractionControllerPDF];
            break;

    }
}
4

1 回答 1

0

kStringURLUIDocumentInteractionControllerPDF一个错误是上面未定义的事实。如果您使用遇到的错误更新问题,我们可以为您提供更好的帮助。

于 2013-05-30T09:53:26.770 回答