我正在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;
}
}