1

I need to show an CameraPopover without any arrow. What I have tried till now is:

var popover = new CameraPopoverOptions(300,300,100,100,0); 
var options = {
                    quality: 75,
                    destinationType: Camera.DestinationType.FILE_URI,
                    sourceType: value,
                    allowEdit: false,
                    encodingType: Camera.EncodingType.JPEG,
                    popoverOptions: popover,
                    saveToPhotoAlbum: false
                };

In the last parameter of CameraPopoverOptions(300,300,100,100,0), I have tried passing 0, undefined, null and other numbers except (1,2,4,8,15) because these numbers are already defined in Camera cordova plugin

Camera.PopoverArrowDirection = {
        ARROW_UP : 1,        // matches iOS UIPopoverArrowDirection constants
        ARROW_DOWN : 2,
        ARROW_LEFT : 4,
        ARROW_RIGHT : 8,
        ARROW_ANY : 15
    };

In native there is one solution but for Cordova project how to do it? Any workaround or suggestion will help.

Bhargav Rao
  • 50,140
  • 28
  • 121
  • 140
Anand Gupta
  • 5,640
  • 3
  • 27
  • 37

1 Answers1

1

Well, with the current code base of the camera plugin project, you can't.

Your zero is not recognized because in the Camera.m class implementation at the initialize method, there is a set of allowed values :

 org_apache_cordova_validArrowDirections = [[NSSet alloc] 
 initWithObjects:[NSNumber numberWithInt:UIPopoverArrowDirectionUp], 
 [NSNumber numberWithInt:UIPopoverArrowDirectionDown], 
 [NSNumber numberWithInt:UIPopoverArrowDirectionLeft], 
 [NSNumber numberWithInt:UIPopoverArrowDirectionRight], 
 [NSNumber numberWithInt:UIPopoverArrowDirectionAny], nil];

Since your zero doesn't appear there, it affects the value UIPopoverArrowDirectionAny :

if (![org_apache_cordova_validArrowDirections containsObject:[NSNumber numberWithUnsignedInteger:arrowDirection]]) {
arrowDirection = UIPopoverArrowDirectionAny;
}

If you want, you can fork the the plugin and add the permitted arrow direction 0.

Zakaria
  • 14,892
  • 22
  • 84
  • 125
  • Thanks for the answer Zakaria.. I have not still got any solution with the current code base but still not accepting ur solution coz I still think there might me any answer. Hence keeping options open. :) – Anand Gupta Mar 29 '16 at 07:07