Bellow 是我的 didFinishPickingMediaWithInfo 方法,我知道我有很多不必要的代码、保留、发布等......但这是我可以让它工作的方式,我害怕在尝试优化它时破坏它。
任何人都可以帮我脱掉不必要的东西并让这个方法干净吗?
另外,我有一个视图控制器,它将加载 4 张照片(相机胶卷或相机),在选择器选择第二张或第三张照片后,应用程序崩溃,或者至少,我收到了下面的这些警报之一。我做错了什么?谢谢!
-2012-06-23 10:54:07.399 LookdoDia[6525:707] 收到内存警告。
-wait_fences:未能收到回复:10004003
- (void)imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary *)info {
[self dismissModalViewControllerAnimated:YES];
UIImage *img = [info objectForKey:UIImagePickerControllerEditedImage];
if(!img) img = [info objectForKey:UIImagePickerControllerOriginalImage];
uiimvImagem.image = [img retain];
uiimvImagem.alpha = 0;
UIImageView *tempImageView = [[UIImageView alloc] initWithImage:img];
self.uiimvImagem = [tempImageView retain];
[tempImageView release];
CGRect frame = uiimvImagem.frame;
frame.size.width = 359;
frame.size.height = img.size.height / (img.size.width / 359);
uiimvImagem.frame = frame;
uisv1.showsVerticalScrollIndicator = NO;
uisv1.showsHorizontalScrollIndicator = NO;
uisv1.contentSize = CGSizeMake(uiimvImagem.frame.size.width, uiimvImagem.frame.size.height);
uisv1.maximumZoomScale = 3.0;
uisv1.minimumZoomScale = 0.8;
uisv1.clipsToBounds = YES;
uisv1.delegate = self;
[uisv1 addSubview:uiimvImagem];
[img release];
}