私はUIImagePickerを表示するモーダルを持っており、ユーザーはUIImageViewに入れられる写真を撮ることができます。UIImagePickerカメラのメモリ警告がUIImageViewに設定されなくなりました
これまでのところ「受信メモリ警告」という警告メッセージが表示され、UIImageViewが割り当てられません。このアプリはかなりシンプルで多くのメモリを使用していないので、ImagePickerと別のプロセスとして多くの時間がかかるようです。これは、カメラを使用している場合にのみ発生し、約5回に1回発生します。
lot of talk about this onlineがあります。ほとんどの回答で「警告を適切に処理する」と答えています。しかし、私はそれが何を意味するのか分かりません - イメージされた写真をImageViewに表示したいだけです!私はUIImagePickerデリゲートでそれについて何かできる前に起こるようです。
私はこれを軽減するために何ができますか? ?
ここdidFinishPickingImage委任です:
- (void)imagePickerController:(UIImagePickerController *)picker didFinishPickingImage:(UIImage *)selectedImage editingInfo:(NSDictionary *)editingInfo {
//set background for image select button, put image reference somewhere to copy image to documents folder and insert into modular's sentence object.
//ImagePicker.jpg needs it's border set to 1px black.
NSLog(@"imagePickerController: selectedimage: %@", selectedImage);
imageViewBehindPhotoBigButton.clipsToBounds = YES;
[imageViewBehindPhotoBigButton.layer setBorderColor: [[UIColor blackColor] CGColor]];
[imageViewBehindPhotoBigButton.layer setBorderWidth: 1.0];
[imageViewBehindPhotoBigButton setBackgroundColor:[UIColor whiteColor]];
[imageViewBehindPhotoBigButton setContentMode: UIViewContentModeScaleAspectFill];
imageViewBehindPhotoBigButton.image = selectedImage;
imageViewBehindPhotoBigButton.hidden = NO;
[choosePhotoBigButton setBackgroundImage:nil forState:UIControlStateNormal];
choosePhotoBarImage.hidden = NO;
choosePhotoText.hidden = NO;
addButton.enabled = YES;
if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad) {
//because iPad uses a pop up - we don't want to dismiss modals here!
[imagePopupController dismissPopoverAnimated:YES];
}else{
[self dismissModalViewControllerAnimated:YES];
}
}
こんにちは、ありがとう。。きみの リンク。これまでのところ、 "メモリ警告"なしで動作するようです。私がここに着陸する前に私も考えましたが、私がそれをやめるのを妨げたのは、画像を縮小しながらより多くの処理量/メモリを消費するかもしれないと思ったからです。再度、感謝します。 – Unheilig