使用PickerView时收到3个警告



当我使用此代码时,我在实现时收到三个警告,说实现不完整,协议库中的方法pageViewController:viewControllerAfterViewController未实现,协议库的方法pageViewController:viewControllerBeforeViewController未实现。我不知道为什么会发生这种情况

这是我的头文件

    IBOutlet UIPickerView     *SaveTopicker;
    NSMutableArray            *arraygenre;
}
@property(nonatomic, retain) AVCaptureStillImageOutput *stillImageOutput;
@property (weak, nonatomic) IBOutlet UILabel *categoryLabel;
@property (weak, nonatomic) IBOutlet UIView *imagePreview;
@property (weak, nonatomic) IBOutlet UIView *saveImage;
@property (weak, nonatomic) IBOutlet UIImageView *captureImage;
@property (weak, nonatomic) IBOutlet UISegmentedControl *cameraSwitch;
@property (weak, nonatomic) IBOutlet UIView *pickerViewContainer;
@property (nonatomic, retain) UIAccelerometer *accelerometer;
@property (weak,nonatomic) IBOutlet UIScrollView *BGScrollView;
- (IBAction)saveButton:(id)sender;
- (IBAction)closeButton:(id)sender;
@property (retain, nonatomic) UIImage *yourImage;

- (IBAction)switchCamera:(id)sender;
- (IBAction)snapImage:(id)sender;
@end

这是我的实现文件
@实现ViewController

@synthesize accelerometer, stillImageOutput, imagePreview, captureImage, cameraSwitch, pickerViewContainer;
- (NSInteger)numberOfComponentsInPickerView:(UIPickerView *)thePickerView {
    return 1;
}
- (NSInteger)pickerView:(UIPickerView *)thePickerView numberOfRowsInComponent:(NSInteger)component {
    if (component == genre)
        return [arraygenre count];
    return 0;
}
- (NSString *)pickerView:(UIPickerView *)thePickerView titleForRow:(NSInteger)row forComponent:(NSInteger)component {
    if (component == genre)
        return [arraygenre objectAtIndex:row];
    return 0;
}

- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil {
    self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
    if (self) {
        // Custom initialization
    }
    return self;

}
- (IBAction)saveButton:(id)sender {
    [UIView beginAnimations:nil context:NULL];
    [UIView setAnimationDuration:0.3];
    pickerViewContainer.frame = CGRectMake(0, 307, 320, 261);
    [UIView commitAnimations];
}
- (IBAction)closeButton:(id)sender {
    [UIView beginAnimations:nil context:NULL];
    [UIView setAnimationDuration:0.3];
    pickerViewContainer.frame = CGRectMake(0, 460, 320, 261);
    [UIView commitAnimations];
}
- (void)pickerView:(UIPickerView *)pickerView didSelectRow:(NSInteger)row inComponent:(NSInteger)component{
    NSArray  *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
    NSString *documentsDirectory = [paths objectAtIndex:0];
    //fetch Category Name from the array used to fill the Picker View
    NSString *categoryName= [arraygenre objectAtIndex:row];
    NSString *fPath = [documentsDirectory stringByAppendingPathComponent:categoryName];
    NSFileManager *fileManager=[[NSFileManager alloc]init];
    [fileManager createDirectoryAtPath:fPath withIntermediateDirectories:YES attributes:nil error:nil];
    UIImage *image = captureImage.image;
    NSData *data = UIImagePNGRepresentation(image);
    [data writeToFile:fPath atomically:YES];
}

您已经声明您的类实现UIPageViewControllerDataSource协议,该协议要求您实现这些方法。如果您实际上不想成为UIPageViewController的数据源,请删除对协议的引用,或者在需要时实现这些方法。

您试图设置UIPicker委托,但却执行PageControl委托。若要撤消此操作,必须找到声明PageviewControllerDelegate的位置并将其删除。然后插入选取器委托。

相关内容

最新更新