和我的代码:
-(voID)createImagePicker {_picker = [[UIImagePickerController alloc] init];_picker.sourceType = UIImagePickerControllerSourceTypeCamera;_picker.cameraCaptureMode = UIImagePickerControllerCameraCaptureModePhoto;_picker.allowsEditing = YES;_picker.showsCameraControls = NO;_picker.cameraDevice = UIImagePickerControllerCameraDeviceRear; _picker.delegate = self;_picker.wantsFullScreenLayout = YES;}
和vIEwWillApper方法:
-(voID)vIEwWillAppear:(BOol)animated{ [super vIEwWillAppear:animated]; [[NSNotificationCenter defaultCenter] addobserver:self selector:@selector(closeCamerabutton:) name:@"ShowMainVIEw" object:nil]; [self createImagePicker]; [m_cameraOverlayVIEw setBackgroundcolor:[UIcolor clearcolor]]; [self presentModalVIEwController:_picker animated:NO]; _picker.cameraOverlayVIEw = m_cameraOverlayVIEw; [cameraimgVIEw setHIDden:YES]; [filterVIEw setHIDden:YES]; m_cameraOverlayVIEw.hIDden = NO; cameraSelectedbutton.hIDden = NO; cancelbutton.hIDden = YES; selectbutton.hIDden = YES; for (ID Object in [scrollvIEw subvIEws]) { if([Object isKindOfClass:[UIbutton class]]) { [Object removeFromSupervIEw]; } } [m_toolbarImage setFrame:CGRectMake(0,427,320,55)]; [cameraSelectedbutton setFrame:CGRectMake(128,432,86,44)]; [m_cancelbutton setFrame:CGRectMake(10,434,82,40)]; [m_cancelbutton setTitle:@"Close" forState:UIControlStatenormal]; [m_cancelbutton setBackgroundImage:[UIImage imagenamed:@"menu-bar-button.png"] forState:UIControlStatenormal]; [m_cancelbutton setTitlecolor:[UIcolor colorWithRed:110/256.0 green:52/256.0 blue:28/256.0 Alpha:1.0] forState:UIControlStatenormal]; [cancelbutton setFrame:CGRectMake(120,35,35)]; [selectbutton setFrame:CGRectMake(184,35)]; }解决方法 无论是否使用ARC,这似乎是iOS 5中UIImagePickerController的一个问题.
我有一个使用xcode 3.2.5为iOS 4开发的应用程序,当从图书馆拍摄或选择照片时,仪器显示没有泄漏(在运行iOS 4.1的设备上测试).在运行iOS 5.1的设备上测试的相同代码如上所述泄漏.
我知道这不是一个答案,但问题似乎比原来的问题更广泛.
总结以上是内存溢出为你收集整理的objective-c – iOS5上的UIImagePickerController内存泄漏全部内容,希望文章能够帮你解决objective-c – iOS5上的UIImagePickerController内存泄漏所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)