Search code examples
iosobjective-ccgaffinetransform

What am I looking for? <Error>: CGAffineTransformInvert: singular matrix


I checked the other solutions on here but non are to do with my problem. So I dont think this is a duplicate. What is it that gives this error? I checked my scrollView and its not set to 0,0 and here is the code to my ImageView picker:

 imagePicker =[[UIImagePickerController alloc] init];
imagePicker.delegate=self;
imagePicker.sourceType=UIImagePickerControllerSourceTypePhotoLibrary;
imagePicker.allowsEditing=YES;


self.popover=[[UIPopoverController alloc] initWithContentViewController:imagePicker];
[self.popover presentPopoverFromRect:self.button.bounds inView:sender permittedArrowDirections:UIPopoverArrowDirectionAny animated:YES];

I cant see the problem, can someone tell me what I am looking for.


Solution

  • First set delegate of UIPopoverController.

    self.popoverController.delegate = self;   
    

    And not sure but Problem is presentPopoverFromRect:self.button.bounds

    so give proper CGRect to it, might be solve your problem . Such like

    CGRect rect = CGRectMake(20, 50, 70, 40);// set as you need 
    self.popoverController = [[UIPopoverController alloc] initWithContentViewController:imgPicker];
        self.popoverController.delegate = self;    
        [self.popoverController presentPopoverFromRect:rect inView:self.scrollView permittedArrowDirections:UIPopoverArrowDirectionAny animated:YES];
    

    And also i don't know what is inView:sender , sender must be UIView.