UIImagePickerController is oversized, extending beyond screen window - ios

I'm noticing in iOS8, when showing an UIImagePicker with a camera via modal, the edge of the screen is cut off.
Here is a sample image (notice the 'flip' icon is cut off on the edge):
Oddly enough, this behavior is on both iPhone 5 & iPhone 6.
I'm working with the standard UIImagePickerController in iOS
UIImagePickerController* picker = [[UIImagePickerController alloc] init];
picker.delegate = self;
picker.allowsEditing = NO;
picker.sourceType = UIImagePickerControllerSourceTypeCamera;
[self presentViewController:picker animated:YES completion:nil];
This is inside of another UIViewController, which fits just fine on the screen. I've played with some of the settings, including 'extend edges', but nothing seems to change this slight cutoff.
Has anyone experienced this, or know of a fix?
UPDATE
I've narrowed the cause down to Pixate's Freestyle library. Disabling the library entirely removes the issue, but deleting all of the styles in my scss files does not fix it, so it must be something deeper in Pixate, rather than a style rule.

Related

How to get uiimagepicker Spinner button action in 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.

iOS, some questions about camera control

I am newbie to iOS programming.
I have a few simple questions.
After picking image from gallery or taking a picture from camera, I want to select
rectangle area like android
UIImagePickerController * picker =[[UIImagePickerController alloc] init];
picker.delegate=self;
picker.allowsEditing=YES;
picker.sourceType=UIImagePickerControllerSourceTypeCamera;
[self presentViewController:picker animated:YES completion:nil];
When I use this code, I can't resize my area as you see below
.
It is related to first question.
As you see my image is resized and changed to different ratio.
But I want image is fixed with original ratio.
Anyone knows how to use camera in iOS simulator?
Question 3: You cannot use the camera function in simulator. That is one of the limitations. See this document from Apple Developer page: https://developer.apple.com/library/ios/documentation/IDEs/Conceptual/iOS_Simulator_Guide/TestingontheiOSSimulator/TestingontheiOSSimulator.html
Question 2: below
This is answer is from this link: How to make UIImageView automatically resize to the size of the image loaded
UIImage img = [UIImage imageNamed:#"myImage.jpg"];
[imageView setImage:img];
imageView.frame = CGRectMake(imageView.frame.origin.x, imageView.frame.origin.y,
img.size.width, img.size.height);
"This will however not change the layout of view it is contained within, you can make it change the sizes of the other views automatically under iOS 6 using Layout Constraints. If you are an Apple Developer you can watch the WWDC instruction videos, they explain how that system works quite well."
It's the best answer I have as it is the way I use setting image sizes in a view.

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

UIImagePickerController Showing Black Preview Screen

I am having a problem when calling the UIImagePickerController to use the camera. Sometimes, but more often than none, the preview screen shows to be black (as the camera itself is covered). After doing some research, it seems that people where not delegating it correctly..however, I believe my set up is correct. A restart of the app is what fixes it.
In my .h file I have included UIImagePickerControllerDelegate and UINavigationControllerDelegate.
Here is the code for the .m file
- (IBAction)camera:(id)sender {
UIImagePickerController *imagePickerController = [[UIImagePickerController alloc] init];
#if TARGET_IPHONE_SIMULATOR
imagePickerController.sourceType = UIImagePickerControllerSourceTypePhotoLibrary;
#else
imagePickerController.sourceType = UIImagePickerControllerSourceTypeCamera;
#endif
imagePickerController.editing = YES;
imagePickerController.delegate = self;
[self presentViewController:imagePickerController animated:YES completion:nil];
}
Any ideas as to why this is happening?
Thank you
I just fought this issue for a day and a half, sure enough I was doing something UI related outside the main thread. In my case I was updating a label in the response handling code for an asynchronous web service call.
In an app with several view controllers that have 2000+ lines of code each in them, this kind of thing can be very difficult to track down. This is what finally brought me to my answer, and VERY quickly at that.
https://gist.github.com/steipete/5664345
This guy posted a class you can download and add to your project. Simply add it to your project, you don't need to use it anywhere or try to instantiate anywhere, just add it to your project. He also states that you should run this without ARC. To do that, go to your Build Phases tab, expand Compile Sources, double click on the file and then type -fno-objc-arc
Now, run your project and navigate to where you are experiencing the black image preview screen. If all goes to plan, at some point prior to that your app should crash and dump to console some information about performing a UIKit action outside the main thread. Based on what your app was doing and what was dumped to console, you should be able to very quickly find the line of code causing you troubles. In my case I was able to call my response handler with a
[self performSelectorOnMainThread:#selector(handleResponse:) withObject:data waitUntilDone:true];
and my problem was gone immediately
Also, this issue only began once I updated to iOS 7, I never saw this in iOS 5 or iOS 6.
The guy who posted the file advises that you do not ship your app with this file included in your project and I strongly agree with that.
Happy debugging!
Try this. it solved my problem, make sure that there is a value
(Application name as string) in your info.plist > "Bundle display name".
In my case it was empty and because of that it didn't work.
If "Bundle display name" is not there in the info.plist,then add a row named "Bundle display name" and paste your appname .
Test this in your device. I think you are testing it in simulator and allowsImageEditing property Deprecated in iOS 3.1 so dont use it .
This can happen when there is animation not started on the main thread going on in parallel to kicking off the imagePickerController
If this is what you are running into you will likely see
<Warning>: CoreAnimation: warning, deleted thread with uncommitted CATransaction; set CA_DEBUG_TRANSACTIONS=1 in environment to log backtraces.
On your console log
I ran into it first by kicking off an activity indicator from a different thread (bug in its own right I know). But more insidiously this hit me due to loading a nib file in a background thread (which calls [CATransaction setDisableActions:] ... who knew)
Turning on CA_DEBUG_TRANSACTIONS in your scheme and then running in your simulator while tailing the system log (tail -f /var/log/system.log) is really the best way to find out the specific culprit.
Try this...
dispatch_async(dispatch_get_current_queue(), ^(void){
imagePicker.sourceType =
UIImagePickerControllerSourceTypeCamera;
imagePicker.delegate = self;
[self presentModalViewController:imagePicker animated:YES];
} ) ;
While it could be an issue that depends on many factor, as shown from the successful solutions provided by other members, I think it's worth mentioning the fact that the user might have denied permissions for camera usage (Under Privacy->Camera->Your application) and thus the camera shows, but displays a black preview screen. It just happened to me, and it depended from a bug in the early development stage in which that question was never seen by the user because of overlapping alerts.
When you're creating the UIImagePickerController change the cameraOverlayView to nil. It worked like a charm for me.
self.imagePickerController.cameraOverlayView = nil;
And that should be it.
Please check [UIApplication sharedApplication].keyWindow.frame

Aviary ios SDK memory not released after dismiss

I am using Aviary SDK 3.0 in my app, I put the Aviary code in a popover like this, but after I dismissed the popover using [popover dismissPopoverAnimated], the Aviary is still in the memory Heap, this is even true, even after I dismissed the parent viewcontroller. is it expected that the Aviary code is cleaned up after I dismiss?
in the action when use tap the photo. I present it here
AFPhotoEditorController *editorController = [[AFPhotoEditorController alloc] initWithImage:imageToEdit];
[editorController setDelegate:self];
if (popover == nil)
popover = [[UIPopoverController alloc] initWithContentViewController:editorController];
else
[popover setContentViewController:editorController animated:YES];
https://dl.dropboxusercontent.com/u/23238574/Screenshots/aviarypopover.png
From the docs:
"Note that pushing the controller onto a UINavigationController's stack is not recommended, since the Photo Editor itself uses a subclass of UINavigationController."
try presenting it modally, then what I do just to make me feel better about all memory getting cleaned is to make a strong property and go through the checklist
[editorController removeFromParentViewController];
editorController.delegate = nil;
editorController = nil;
something about clearing the delegate seems to clear my memory better, although, I don't think you need it.
also, don't forget:
"By default, Aviary keeps a small number of OpenGL objects loaded to optimize launches of Aviary products."
[AFOpenGLManager requestOpenGLDataPurge];
// to request a clear,
// "Calls to requestOpenGLDataPurge only apply to the currently loaded OpenGL data,"
You can set it to clear regularly with
[AFPhotoEditorCustomization purgeGPUMemoryWhenPossible:YES];
if you're doing this, it's a good idea to preload some of the editor if you know they'll be using it soon
[AFOpenGLManager beginOpenGLLoad];
This memory leak has been addressed in subsequent releases of the SDK. Please visit developers.aviary.com to get the latest version.

Resources