我已經嘗試了很多的解決方案,但非已工作尚未的UIImageView在iPhone
繼承人我在做什麼:
if ([UIImagePickerController isSourceTypeAvailable:UIImagePickerControllerSourceTypeCamera])
{
UIImagePickerController *imagePicker = [[UIImagePickerController alloc] init];
imagePicker.delegate = self;
imagePicker.sourceType = UIImagePickerControllerSourceTypeCamera;
imagePicker.modalPresentationStyle = UIModalPresentationCurrentContext;
//imagePicker.allowsEditing = YES;
NSOperatingSystemVersion ios8_0_0 = (NSOperatingSystemVersion){8, 0, 0};
//This was suggested in answer of some question of stackoverflow
if ([[NSProcessInfo processInfo] isOperatingSystemAtLeastVersion:ios8_0_0])
{
if([[UIDevice currentDevice]orientation] == UIDeviceOrientationFaceUp)
{
if([UIApplication sharedApplication].statusBarOrientation == UIInterfaceOrientationLandscapeLeft)
{
[[UIDevice currentDevice]setValue:[NSNumber numberWithInteger:UIDeviceOrientationLandscapeRight] forKey:@"orientation"];
}
else
{
[[UIDevice currentDevice]setValue:[NSNumber numberWithInteger:UIDeviceOrientationLandscapeLeft] forKey:@"orientation"];
}
}
}
self.imagePickerController = imagePicker;
[self presentViewController:self.imagePickerController animated:YES completion:nil];
}
當上述didnt工作,我嘗試了一些別的東西同時節約圖片
NSData *imgPngData = UIImagePNGRepresentation([info objectForKey:UIImagePickerControllerOriginalImage]);
UIImage *image = [UIImage imageWithData:imgPngData];
imgPngData = UIImagePNGRepresentation(image);
[_profilePicture setImage:[UIImage imageWithCGImage:[image CGImage] scale:1.0 orientation:UIImageOrientationUp]];
,但對行爲產生任何影響。這是Iam拍攝這張照片時發生的事情。
這是什麼出現在我的ImageView
請提出了一些事情。提前感謝你們所有人。
爲什麼正常功能的arent工作的人?有沒有什麼好的理由來實現這個調整? –
下面的評論不是很好,所以很多人都寫了關於應用程序崩潰的內存。你也面對過嗎? –
是的,如果你試圖拍攝這麼多次的照片,那麼它可能是應用程序得到崩潰..坦率地說,不知道這個實現的確切原因...試圖得到根本原因,但沒有得到它的任何地方..如果你發現任何地方,請與我分享.. –