How to get uiimagepicker Spinner button action in iOS? - ios

I'm using below code.
self.picker=[[UIImagePickerController alloc] init];
self.picker.delegate=self;
self.picker.allowsEditing=NO;
self.picker.sourceType=UIImagePickerControllerSourceTypeCamera;
self.picker.cameraOverlayView=[self addCameraRollButton];
[self presentViewController:self.picker animated:NO completion:NULL];
How to take picture from camera without going to Usephoto page. I want to stay on camera view. I'm not able to get camera spinner action.I used custom overlay but in that Square focus not coming.Please help me.I want all default camera features.

Once you use custom overlay you will not be able to see default camera features.If you want all default features you should use
self.picker.showsCameraControls = YES;
This opens default camera and you can see all features.
If you want to go with custom overlay then you need to built all features.

Related

Overlay text on the application to show debug information

I am basically developing an iOS SDK which will be used by other apps using Cocoa pods. My question is:
Is it feasible to overlay plain text on the screens of the host app, showing them important debug information(as they use the app)? pretty much like the fps information on games screens. If yes, suggestions?
Have been searching around but all I can find are discussions around overlaying on Camera, Map and Video player, like the following:
How do i overlay a text box over a native camera view in IOS
Is it possible to add a text overlay to videos?
Change text of label in ios camera overlay UIPickercontroller
Text overlay not showing in GPUImage iOS
Any guidance in this respect would be appreciated.
Yes, should be feasible, I would add a "debug" subview to the window and set the userInteractionEnabled = NO so that view does not consume touches.
Something like this should get you started:
#if DEBUG
UILabel *debugInfo = [[UILabel alloc] init];
debugInfo.text = #"some debug information here";
debugInfo.numberOfLines = 0;
[debugInfo sizeToFit];
debugInfo.userInteractionEnabled = NO;
[[[[UIApplication sharedApplication] delegate] window]addSubview:debugInfo];
#endif

Display 3D-Object with COCOS3D on top of AR-View

I work on an app, which scans an image and shows you a 3D-Object or a video on top of the image target. Normal AR-App. For that AR stuff I usw the Vuforia SDK. The problem is, that the Vuforia SDK don't support animated 3D-Objects and for that I use cocos3d.
So I created a basic cocos3d app and included my vuforia stuff for the AR. This works good and the app displays normal 3D-Objects and videos. This was the background, now the problem.
The first view I have is my camera view, which scans the images. If I scan now a specified target, I want to show an animated 3D-Object. For that, I display the cocos3d view on top of the AR-View. The cocos3d view is transparent and is displayed on top of the AR-View (tested this with a simple button in the cocos3d view).
The problem is, that I'am not able to display a animated 3D-Object. I tested some options but none of them worked because I don't really have an idea how to do that. My current code:
CCDirector *director = CCDirector.sharedDirector;
EAGLViewCC *glView = [EAGLViewCC viewWithFrame:[window bounds] pixelFormat:kEAGLColorFormatRGBA8 depthFormat:GL_DEPTH_COMPONENT16_OES];
[director setOpenGLView:glView];
[window addSubview:director.openGLView];
After that I have a layer and add the test scene to my layer (Standard from the example). But than I don't know how to display it. It tried this:
[director pushScene:scene];
but no luck. In the example, they use this code to show the object (viewController is of type "CC3DeviceCameraOverlayUIViewController").
[viewController runSceneOnNode: mainLayer];
Why don't I use the viewController? Because I couldn't get the view transparent. So how do I get the 3D-Object displayed in my view? What do I have to do? Am I completely wrong?

iOS7 UIImagePickerController allowsEditing not working correctly

In someViewController:
UIImagePickerController* picker = [[UIImagePickerController alloc] init];
picker.allowsEditing = YES;
picker.sourceType = UIImagePickerControllerSourceTypeCamera;
picker.delegate = self;
[self presentViewController:picker animated:YES completion:^{
}];
I take a photo and get to the next screen where (due to allowsEditing = YES;) I have an option to crop my photo into square shape. White square rectangular appears on an initial position over the photo I've taken and I try to move it around. I can drag it, but every time I release the finger, it goes back to the position it held initially. The are no glitches. When I release the finger, white framed rectangular animates with easeOut animation back to the position where I dragged it from.
It is not the same as if allowsEditing is set to NO. If it is set to NO, than a cropping rectangle does not even appear.
Previously, I thought that the problem appears only on iOS 7, but now I realise that it happens on all iOS versions. I don't understand how this happened, but it started when I started using Xcode 5 and building for iOS7. I kept Xcode 4.6.3 on my Mac so I tried to build this app again with the older Xcode, but it did not fix anything.
I also need to mention that when I load an image from photo library, cropping works fine, like it is supposed to. I have problems only when taking a new photo.
Furthermore, when initial crop rectangle appears, although I am unable to drag that rectangle around the photo, I can still zoom in and out. When I zoom in, I can then drag this (smaller) cropping rectangle around the photo but ONLY within boundaries of initial rectangle's position & size. If I cross that boundary, my cropping rectangle animates back to the inside of the invisible boundaries.
Anyone, please help...
It seems like this is a bug with UIImagePickerController. I was trying to figure out what I did wrong. But then I started a couple of blank new projects just to test this functionality. I also checked out the Apple's official sample code:
https://developer.apple.com/library/ios/samplecode/photopicker/Introduction/Intro.html

Passing a UIIImage to UIImagePickerController for editing

Is it possible to provide UIImagePickerController a UIIMage object, to use editing functionality provide this pickerController.
This is how I am trying to implement it.
-(IBAction) openEditor:(id) sender{
UIImagePickerController *pickerCntrl=[[UIImagePickerController alloc] init];
pickerCntrl.sourceType=UIImagePickerControllerSourceTypeSavedPhotosAlbum;
pickerCntrl.allowsEditing=YES;
[self presentViewController:pickerCntrl animated:YES completion:nil];
}
But, for this Image must be already present in the Album. Another thing is it provides a UI for you to select the Image.
I am trying to open directly the following window on openEditor:(id) sender.
The UIImagePickerController is for picking an image (either from the photo library or the camera). It can't be used for any kind of editing of any arbitrary image you wish to supply.
If you want to provide scaling and cropping of your own image then you must implement your own image editing controller.
Either implement your own or look into a 3rd party library that already does this. I've had good luck with the Aviary SDK.

UIImagePickerController always pics 640x640 image

When I present a UIImagePickerController in my iPhone App, it always comes up with a white square with a frame around it, and the user has can zoom in and out of an image and make it fit within the white square. Whatever they fit in the white square is what is returned to:
- (void)imagePickerController:(UIImagePickerController *)picker didFinishPickingImage:(UIImage *)img editingInfo:(NSDictionary *)info
and it is always 640x640.
Why can't the user select an entire image? Why does this white square even come up?
Built in editing is very limited. Here is what the Apple documentation says:
Editing controls To specify whether the camera interface should offer
the user controls for moving and scaling the captured picture, or for
trimming the captured movie, set the allowsEditing property to YES (to
provide editing controls) or to NO.
When using built-in editing controls, the image picker controller
enforces certain options. For still images, the picker enforces a
square cropping as well as a maximum pixel dimension. For movies, the
picker enforces a maximum movie length and resolution. If you want to
let the user edit full-size media, or specify custom cropping, you
must provide your own editing UI.
Make sure you're not enable editing for the UIImagePickerController.
You just need this:
UIImagePickerController* imagePicker = [[UIImagePickerController alloc] init];
[imagePicker setSourceType:UIImagePickerControllerSourceTypePhotoLibrary];
[imagePicker setDelegate:self];
[controller presentModalViewController:imagePicker animated:YES];
[imagePicker release];

Resources